On Mon, Sep 1, 2008 at 6:39 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > 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 >
It's a requirement from the client side, according to them as only "good" code gets submitted from development environment to the production environment, they don't need "use warnings" and also "perl -w" as well. It might sound strange to you, (I also got surprised when I came to know about it), but that's the truth ! Regards, Amit Saxena