in reply to Correct keys in hashes
update: as demonstrated by ikegami below, actually only valid identifiers are quoted: that means anything matching /^[a-zA-Z_]\w*$/ but not numbers.
As long as you use valid keys, and don't use version strings (/^v\d+$/) the quoted and unquoted keys are equivalent.
The version strings implementation makes $hash{v80} != $hash{'v80'} etc. in some versions of perl, so for portability these keys should always be quoted.
So, in short, if you don't want to think about the keys you use, quote them, but usually an intuitive key name can be used unquoted.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Correct keys in hashes
by ikegami (Patriarch) on Aug 25, 2004 at 15:36 UTC | |
by Joost (Canon) on Aug 25, 2004 at 16:10 UTC |