Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
hash assignment wierdnessby Bro. Doug (Monk) |
on Apr 20, 2007 at 15:29 UTC ( [id://611184]=perlquestion: print w/replies, xml ) | Need Help?? |
Bro. Doug has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed Monks,
I understand that undef() and hashes are not meant for each other. That said, I was wondering if anyone could specifically explain the wierdness occurring when you run the following piece of code.
It seems to me that the hash is undefined until you try to assign something to it, and it doesn't matter what that something is. Also, I'm confused as to why, in this case, using undef as a function actually performs the undefine on the hash. Peace monks, Update: I've followed advice and added use warnings and use strict (this started as a perl -e that was being passed around my office). We've also used Data::Dumper on it, just for play.
Bro. Doug :wq
Back to
Seekers of Perl Wisdom
|
|