in reply to beginner question - why is hash key unquoted and in capitals
So $hash{CODEREF} and $hash{"CODEREF"} are the same thing.
Another typical usage would be
Again the keys to the hash are implicitely quoted.my %hash = ( HUBBA => 1, BUBBA => 2 );
However you have to be careful when you use non-chars in the key: $hash{HUBBA-BUBBA} will not work as the Perl-parser parses the key as an expression and you get an error (you would have to quote explicitely here: $hash{"HUBBA-BUBBA"}.
The use of all-caps is only a matter of taste and has no significance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: beginner question - why is hash key unquoted and in capitals
by morgon (Priest) on Oct 16, 2010 at 16:45 UTC |