use strict; use warnings; use Hash::Util qw( lock_keys unlock_keys ); my %hash = ( 'name' => "Doraemon", 'age' => "1000" ); lock_keys( %hash ); # oh! my birthday, i'm getting older $hash{'ege'} = "1001"; # oops, just TRIED to add new key.
...and the output...
Attempt to access disallowed key 'ege' in a restricted hash at C:\Perl\scripts\hashtest.pl line 14.
Enjoy!
Dave
In reply to Re: hash, a troublemaker?
by davido
in thread hash, a troublemaker?
by Doraemon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |