in reply to prevent stringification for hash-keys
See the core module Hash::Util.
use strict; use warnings; use Hash::Util 'lock_keys'; my $key = 'foo'; lock_keys my %hash, ($key, 'bar'); $hash{$key}++; $hash{'key'}++; __END__
$ perl 1230007.pl Attempt to access disallowed key 'key' in a restricted hash at 1230007 +.pl line 11.
Hope this helps!
The way forward always starts with a minimal test.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: prevent stringification for hash-keys
by morgon (Priest) on Feb 16, 2019 at 23:52 UTC |
In Section
Seekers of Perl Wisdom