Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

According to "Programming Perl", "You may also set the $SIG handler to either of the strings "IGNORE" or "DEFAULT", in which case Perl will try to discard the signal or allow the default action for that signal to occur (...)." Based on what I've seen "IGNORE" behaves no differently than "DEFAULT", "" or undef.
#/usr/bin/perl use strict; use warnings; { local $SIG{__WARN__}="IGNORE"; warn '$SIG{__WARN__} was set to "IGNORE"!'; <=== appears }; { local $SIG{__WARN__}= sub {}; warn '$SIG{__WARN__} was set to sub {};!'; <=== doesn't appear };
gives
$ perl SIGWARN.pl $SIG{__WARN__} was set to "IGNORE"! at SIGWARN3.pl line 8. $
Shouldn't ="IGNORE" and =sub {} behave similarly?

Replies are listed 'Best First'.
Re: Meaning of $SIG{__WARN__}="IGNORE";
by Joost (Canon) on Mar 11, 2008 at 23:35 UTC
      Thank you very much!