in reply to using constants
The quotes are optional on barewords used as hash elements.
$hash{key} is the same as $hash{'key'}
$hash{shift} is the same as $hash{'shift'}
$hash{K} is the same as $hash{'K'}
Use
$hash{K()},
$hash{&K},
$hash{(K)} or
$hash{+K}
to work around the autoquoting.
Update: I thought I'd add a link to the relevant documentation, but I can't find documentation on this. perldata mentioned the auto-quoting property of =>, but not of the hash index.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using constants
by Hena (Friar) on Oct 13, 2005 at 05:57 UTC | |
by ikegami (Patriarch) on Oct 13, 2005 at 06:05 UTC |