|Perl Language Reference Manual|
by Larry Wall and others
Paperback (6"x9"), 724 pages
RRP £29.95 ($39.95)
Sales of this book support The Perl Foundation! Get a printed copy>>>
24.1 Default Warnings and Optional Warnings
Before the introduction of lexical warnings, Perl had two classes of warnings: mandatory and optional.
As its name suggests, if your code tripped a mandatory warning, you
would get a warning whether you wanted it or not.
For example, the code below would always produce an
warning about the "2:".
my $a = "2:" + 3;
With the introduction of lexical warnings, mandatory warnings now become
default warnings. The difference is that although the previously
mandatory warnings are still enabled by default, they can then be
subsequently enabled or disabled with the lexical warning pragma. For
example, in the code below, an
"isn't numeric" warning will only
be reported for the
my $a = "2:" + 3; no warnings; my $b = "2:" + 3;
Note that neither the -w flag or the
$^W can be used to
disable/enable default warnings. They are still mandatory in this case.
|ISBN 9781906966027||Perl Language Reference Manual||See the print edition|