On Mon, Jan 19, 2009 at 1:46 PM, Dan Linder
<dan@linder.org> wrote:
Just to follow-up on my previous e-mail, here are my results and a test case.
I added the "no warnings qw(uninitialized)" jusst before my line 57, but left out the "use warnings qw(uninitialized)" as Jay suggested and it worked like a charm.
In another section of code, I had similar warnings but that code called a few other subroutines. I setup this code to test if the "no use warnings" would carry over to the subroutine:
dan:/tmp$ cat d30.pl
#!/usr/bin/perl
use warnings;
sub myfunc {
$f1 = 123;
}
$x = 10;
for (1..1) {
no warnings;
$y = 10;
$funcreturn = myfunc();
}
$z = 10;
dan:/tmp$ ./d30.pl
Name "main::f1" used only once: possible typo at ./d30.pl line 6.
Name "main::z" used only once: possible typo at ./d30.pl line 15.
Name "main::x" used only once: possible typo at ./d30.pl line 9.
dan@dglaptop:PerlTests$
The "no warnings" does not carry out of the current block of code into the subroutine (I got the "main::f1 used only once").
Thanks for the input everyone,
$f1 is not in the C<for> block. It is globally defined. ( wont compile with C<use strict;> )