For example:
#!/usr/local/bin/perl -w %hash = (foo => 42, bar => 23); lock_keys(%hash); # Now, try to set %hash{'something'} while(my($key, $value) = each %hash) { print "$key -> $value\n"; } unlock_keys(%hash);
You can lock specific values as follows:
#!/usr/local/bin/perl -w %hash = (foo => 42, bar => 23); lock_key(%hash, 'foo'); # Now, try to set 'foo' and see what happens unlock_keys(%hash, 'foo');
Copyright © 2002 O'Reilly & Associates. All rights reserved.