in reply to Curious about Hashes which viewed as a list has only one item
It's a key, with the undefined value as its corresponding value. If you have warnings enabled you'll get a warning "Odd number of elements in hash assignment"
If you use that hash in list context you'll get a list of a single element which contains that string HASH... By the way, note that it is a string, it's not an actual reference. The reason is that in Perl, hash keys are always treated as strings; other scalars (numbers, references, undef) are stringified when you use them as a hash key.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Curious about Hashes which viewed as a list has only one item
by ack (Deacon) on Feb 29, 2008 at 05:28 UTC | |
by Errto (Vicar) on Feb 29, 2008 at 17:37 UTC |
In Section
Seekers of Perl Wisdom