in reply to param = 0, not NULL

Actually, it thinks 0 is not true. As it happens, it isn't.

The following are all not true: undef, 0, "", "0" and by extension the empty list and from that, an empty hash.

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

Replies are listed 'Best First'.
Re^2: param = 0, not NULL
by leocharre (Priest) on Mar 29, 2007 at 13:22 UTC
    This is interesting.. an empty hash is false, but an empty hash reference.. is TRUE. :-)
    #!/usr/bin/perl -w my %hash = (); %hash or print "empty hash is false\n"; my $hash = {}; print "empty hash ref is true\n" if $hash ;

      There is no such thing as an "empty hash reference". Or, if there is then the only possible meaning that it could have would be an undefined scalar.

      I think you mean "a reference to an empty hash is TRUE". And that's because Perl has already allocated storage for the hash and given you a reference to it. And a reference is always true.

      --

      See the Copyright notice on my home node.

      "The first rule of Perl club is you do not talk about Perl club." -- Chip Salzenberg