Keep It Simple, Stupid | |
PerlMonks |
Re^2: hash from sub directly into foreach loopby GrandFather (Saint) |
on Jun 30, 2006 at 11:30 UTC ( [id://558552]=note: print w/replies, xml ) | Need Help?? |
Note that:
is equivelent to
which is equivelent to:
The first use of a hash ref autovivifies the referred hash making the previous assignment redundant (and misleading). Consider:
which prints:
and note that the contents of $s changes from an undefined value to a hash ref. If you really want to indicate intent with an assignment use:
DWIM is Perl's answer to Gödel
In Section
Seekers of Perl Wisdom
|
|