in reply to Re^4: On Commenting Out 'use strict;'
in thread On Commenting Out 'use strict;'
What I mean is when you write a script, and run it, and Perl gives you an error message, it means there is a problem that must be fixed or the script won't run (properly|at all).Well, you are right in the sense that whenever Perl gives an error message, it stop execution/compilation. But there are many cases where Perl could have continued - and everything would worked as planned. Triple so in the case of warnings. Consider this program:
It won't run, because Perl refuses it to compile. But if you remove the generation of the error message and its subsequent refusal to continue, for instance, by removing the 'use strict;' line, out outcommenting the relevant part in the source of perl, the program runs fine. There's an error message, but the program doesn't contain bugs.use strict; while ($str = <>) { print lc $str; }
And then there are the numerous, pointless, warning messages:
which you see written as:print (1) qw /#/ $foo + $bar
just to please 'use warnings'.print +(1) qw /\#/ ($foo || 0) + ($bar || 0)
In Section
Meditations