Suic Suic - 1 year ago 108
Perl Question

Perl no warnings 'experimental' on old perl

I have a piece of code which uses a lot of experimental (

) 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
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?

Answer Source

Try if:

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