Amit Saxena wrote: > > What's the difference between "perl -w" and "use warnings" in perl ? > > If there is no difference, then the "use warnings" can be removed from the > perl programs and replace them with "perl -w".of removing "use warnings".
The difference is that the pragma is lexically scoped (it affects only statements in the block of code where it appears) and it allows fine control over warning categories. So for instance you could write use strict; use warnings; my $s = 'xxx'; { no warnings qw/substr uninitialized/; my $sub = substr $s, 10, 10; print $sub; } which is impossible with the command line switch, which is either on or off. See perldoc perllexwarn for details. And I'm wondering why you would want to remove 'use warnings' from your program? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/