in reply to Re: Turn matching against undef to be deadly
in thread Turn matching against undef to be deadly

Thanks, vsespb.

The likelihood of change in warning and having to match against a string are the reasons why I forgot to mention about WARN signal as soon as I had thought about it before posting.

  • Comment on Re^2: Turn matching against undef to be deadly

Replies are listed 'Best First'.
Re^3: Turn matching against undef to be deadly
by vsespb (Chaplain) on Sep 26, 2013 at 13:50 UTC
    As another Anonymous Monk pointed above you can use warnings 'FATAIL' for all warnings or only "uninitialized". Lexical scope used. But this will catch other types of "uninitialized" warnings.
    use strict; use warnings; use Carp; use warnings FATAL => 'uninitialized'; printf "matched: %s\n" , ( 'x' =~ undef() ? 'yes' : 'no' ) ; print "end\n";

      See perllexwarn for all the warnings that can be turned into FATAL-ities, etc.     (Update: Oops — didn't notice Anonymonk already linked these!)