in reply to non-autovivifing hash
I'd only use this for a few keys, in general, the other solutions offered are far superior.use constant FIRST_NAME => "first_name"; use constant LAST_NAME => "last_name"; my %some_hash = ( FIRST_NAME() => "john", LAST_NAME() => "doe", ); my $f_name = $some_hash{FRIST_NAME()}; # caught by perl -c my $f_name = $some_hash{"frist_name"}; # autovivifies ...
|
|---|