Zeus Odin wrote:

The reason why you don't get the uninitialized warning in the 2nd and 3rd
examples below is that your print is within the for loop. Since both @files
and keys %files contain nothing, the innards of the for loop NEVER get
executed. Therefore, the print is not attempted at all for examples 2 and 3.

Correct, except I still think @ ans % don't get uninitialized value warnings while $ does:


$perl -mstrict -we 'my $foo;print "hi\n" for $foo;'
hi
$

That shows what you said to be accurate.

Then no error:
$ perl -mstrict -we 'my @foo;print @foo;'
$
$ perl -mstrict -we 'my %foo;print %foo;'
$

Error:
$ perl -mstrict -we 'my $foo;print $foo;'
Use of uninitialized value in print at -e line 1.
$

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to