develooper Front page | perl.perl5.porters | Postings from March 2013

Re: Perlfunc for each(), keys(), values() has been changed

Thread Previous | Thread Next
From:
demerphq
Date:
March 30, 2013 05:45
Subject:
Re: Perlfunc for each(), keys(), values() has been changed
Message ID:
CANgJU+W8Td+UuGviN+s-_SvB75ZStD7AQwuWxk8Zyg=270VQcg@mail.gmail.com
On Friday, 29 March 2013, Eric Brine wrote:

> On Fri, Mar 29, 2013 at 10:39 AM, demerphq <demerphq@gmail.com<javascript:_e({}, 'cvml', 'demerphq@gmail.com');>
> > wrote:
>
>> Well it means that
>>
>> foreach my $key (keys %hash) {
>>   delete $hash{$key};
>> }
>>
>> will never change the iteration order.
>>
>
> So you can delete arbitrary keys without changing order?
>

I never said you could did I?


>
> On Fri, Mar 29, 2013 at 7:39 AM, demerphq <demerphq@gmail.com<javascript:_e({}, 'cvml', 'demerphq@gmail.com');>
> > wrote:
>
>> Any insertion into the hash may change the order, as will any deletion
>
>
> So you can't delete arbitrary keys without changing order?
>

Have you been drinking? are you tryin to wind me up? I mean seriously, why
would you omit the text that immediately follows that which you are
quoting? The text that specifically states the one circumstance in which
you can delete an item from a hash and be guaranteed to not have the hash
order change...

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

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