Perl no warnings 'experimental' on old perl

perl, warnings

Solution

Try if:

no if ($] >= 5.018), 'warnings' => 'experimental';

Problem

I have a piece of code which uses a lot of experimental (`when`, `smartmatch`, `given`) features, it's not my code, and I don't want to see a lot of warnings about experimental features. So I added `no warnings 'experimental';` to this code. But `experimental` category was added only in perl 5.18 so my code dies in older perls: Unknown warnings category 'experimental' How can I disable this warnings and do not break my code in older perls?

Original source