Re: print statement creates key in hash with reference to empty array??
- From: Ala Qumsieh <notvalid@xxxxxxxxx>
- Date: Tue, 31 Jan 2006 18:49:27 GMT
rhorizon74 wrote:
Thanks for the help.
That explains what is happening (i had used the exists approach to work around). But it does seem bogus that for a simple print statement i need to check each and every level. I havent seen too many languages do something like this (i may be wrong). But a print statement shouldnt really be creating any data.
It is not the print(), it is the fact that you are trying to access the value of the ABC key. If hashes didn't autovivify, then you won't be able to do this:
$hash{key1}{key2}{key3} = 'value';before you actually create all the keys explicitly:
$hash{key1} = {};
$hash{key1}{key2} = {};
$hash{key1}{key2}{key3} = 'value';Autovivification is a Good Thing (tm).
--Ala
.
- References:
- print statement creates key in hash with reference to empty array??
- From: rhorizon74
- Re: print statement creates key in hash with reference to empty array??
- From: it_says_BALLS_on_your forehead
- Re: print statement creates key in hash with reference to empty array??
- From: rhorizon74
- print statement creates key in hash with reference to empty array??
- Prev by Date: Re: print statement creates key in hash with reference to empty array??
- Next by Date: Re: Transform hash key?
- Previous by thread: Re: print statement creates key in hash with reference to empty array??
- Next by thread: Re: print statement creates key in hash with reference to empty array??
- Index(es):
Relevant Pages
|