Apologies, I was asleep at the wheel during my last response.
:-)

The only answer I have is that this is how the designers of Perl decided
that the printing of undefined $, @, and % would work. This is probably due
to the fact that the undefined value of a scalar *is* different from the
undefined value of a hash or an array. Take for instance:

$ perl -mstrict -MData::Dumper -we "my $; print Dumper $s;"
$VAR1 = undef;

$ perl -mstrict -MData::Dumper -we "my @a; print Dumper [EMAIL PROTECTED];"
$VAR1 = [];

$ perl -mstrict -MData::Dumper -we "my %h; print Dumper %h;"

$ perl -mstrict -MData::Dumper -we "my %h; print keys %h;"

$ perl -mstrict -MData::Dumper -we "my %h; print Dumper \(keys %h);"

$ perl -e "print ()"

$ perl -e "print +()"

$ perl -mstrict -we "print undef;"
Use of uninitialized value in print at -e line 1.

$ perl -mstrict -we "print (undef);"
Use of uninitialized value in print at -e line 1.

$ perl -mstrict -we "print +(undef);"
Use of uninitialized value in print at -e line 1.


This says to me that printing undef (unitilialized scalar) is different from
printing an empty list (undefined array). However, printing an undefined
hash in any fashion, outputs nothing. I did not expect that.

Hope that helps,
ZO



"JupiterHost.Net" <[EMAIL PROTECTED]> wrote in message ...
>
> Zeus Odin wrote:
> > To see the code that is actually getting compiled, try:
> >
> > $ perl -MO=Deparse -mstrict -we 'my @foo;print @foo;'
>
> Ok, not sure what that has to do with @ and % not getting uninitialized
> warnings and $ getting them...



-- 
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