in reply to Re: How to create a hash whose values are undef?
in thread How to create a hash whose values are undef?
Perl has the ability to automatically bring a new key into existence when you assign something to it without the need for that key to have been created beforehand - this is true in n-dimensional hash structures also. So in many situations, there is no need to make an "undef" value for a key or even to create that key. Sometimes there is a need ("in many situations" does definitely not mean "in all situations").
I am just curious as to why you want to do this?
Update: I am not saying that anything in the other posts is wrong - quite the contrary - there are some excellent formulations of how to do this. Grandfather's stuff looks fantastic to me. I'm just saying that often it is not necessary to set a whole bunch of keys to "undef" in the first place. Maybe in this application it is warranted. But if its not needed, then there can be some simplifications.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to create a hash whose values are undef?
by cdarke (Prior) on Jul 06, 2009 at 11:43 UTC | |
by Marshall (Canon) on Jul 06, 2009 at 12:11 UTC | |
by cdarke (Prior) on Jul 07, 2009 at 07:36 UTC |