Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I read as far as your premise. It's wrong. To test if a scalar has been set use:
To test if a hash key/value pair exists use:
To test if the scalar content of a hash value has been set use:
Those last two steps can be combined:
and of course you can make the same tests with a multi-dimensional hash:
This last example is interesting if key1 didn't exist - it pops into existence. This is a process called autovivification and happens when Perl needs to have a hash or array element in order to write to it or use it to access an element is references. True laziness is hard work In reply to Re: Best Multidimensional Hash Practices?
by GrandFather
|
|