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

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

Thread Previous | Thread Next
From:
Miller, Scott L
Date:
July 31, 2001 07:26
Subject:
RE: [PATCH for discussion] new feature: clamp %hash
Message ID:
379A67AE5E644D40913DF74AA54DF42F03187F@omacpdexchm01.CPQCEI.NET
> 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:

$hash{a}="foo";
$hash{a}="bar";

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
clamped.

-Scott

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About