develooper Front page | perl.perl5.porters | Postings from July 2001

RE: [PATCH for discussion] new feature: clamp %hash

Thread Previous | Thread Next
Miller, Scott L
July 31, 2001 07:26
RE: [PATCH for discussion] new feature: clamp %hash
Message ID:
> Just want to reiterate the point that if we can change the value of a
> key, we should be able to delete the key *and* reinstate it.
>     my %hash = (a => 1, b => 2);
>     readonly %hash;
>     $hash{a} = "foo";
>     delete $hash{a};
>     $hash{a} = "bar";

Probably a newbie type question, but:

Why would you want to do this, when you can simply say:


and get the same affect?  It seems to me that it would be much more
expensive to delete the key between the assignments...

I'd say clamped is clamped, and you can't delete the key if it's


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About