in reply to strict "vars" mode for hash key literals?
See *lock_keys*.use Hash::Util 'lock_keys'; my %hash; lock_keys %hash, qw/foo bar baz/; # define hash keys to use say $hash{foo}; # ok, declared say $hash{bah}; # compile-time error, undeclared say $hash{$var}; # ok, not literal
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: strict "vars" mode for hash key literals?
by ikegami (Patriarch) on Oct 18, 2016 at 16:18 UTC | |
by kennethk (Abbot) on Oct 18, 2016 at 17:32 UTC | |
by AnomalousMonk (Archbishop) on Oct 18, 2016 at 18:47 UTC | |
by hippo (Archbishop) on Oct 18, 2016 at 16:24 UTC |