As far as I know, the use warnings
pragma was introduced as:
- it is easier for people who are on non 'shebang supporting' systems to use.
- it can be disabled for certain blocks etc.
Here's an introduction to the new pragma from the What's new in Perl 5.6 page:
Lexical Warnings'Death is not good. I reject death. I will stay away from trucks today.' - lwall
The way Perl generates warnings has also been completely revised: as a replacement for the -w flag and the $^W special variable, the
warnings pragma gives you more flexibility about what warnings you receive and when. In terms of what, you can now specify warnings by category: there are a bunch of standard categories, such as 'syntax', 'io', 'void', and
modules will be able to define their own categories. You can also choose to escalate any categories of warning into a fatal error.
As for when, the pragma is lexically scoped, so you can switch it on and off as you wish:
$a = @a; # This generates a warning.
$a = @a; # This does not.
See perllexwarn for how to use this from programs and modules.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||