On 04/04/2013 00:29, Angela Barone wrote:
I'm just curious about this. If you put "no warnings" inside a loop,
is it good only for that loop, or will it be in effect until the end
of the script?
Hi Angela
The `warnings` pragma is *lexically* scoped. That means it applies to
the (rest of) the smallest enclosing block or file.
If your loop looks like
for my $i (@list) {
no warnings;
...
}
or
while (my $line = <>) {
no warnings;
...
}
then the `no warnings` applies to the block enclosed by braces {...}
If you have used a statement modifier
no warnings;
print "$_\n" for @data;
then it applies from there on to the next end of block or end of file.
HTH,
Rob
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/