On Fri, 14 Jan 2005, Mark Cohen wrote:
>
> While the use strict is quite clear to me "Perl pragma to restrict unsafe
> contructs" ,
> the use warnings "Perl pragma to control optional warnings" is not.
> What programming risks could I get without the use warnings ?
perldoc -q warnings
Found in FAQ 7
How do I temporarily block warnings?
If you are running Perl 5.6.0 or better, the "use warnings" pragma
allows fine control of what warning are produced. See perllexwarn for
more details.
{
no warnings; # temporarily turn off warnings
$a = $b + $c; # I know these might be undef
}
so as an example, run this program
-------------------------------------
#!/usr/bin/perl -w
use strict;
use warnings;
my ($a,$b,$c);
&addit;
sub addit
{
#no warnings; # temporarily turn off warnings
$a = $b + $c; # I know these might be undef
}
print "$a\n"
---------------------------------------
Firstly as is, then secondly with the # removed from #no warnings
Perhaps you will see the difference, and value of warnings
Owen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>