develooper Front page | perl.perl5.porters | Postings from January 2021

Re: local %SIG = (%SIG, $signame => ...) not working as expected?

Thread Previous | Thread Next
From:
Uri Guttman
Date:
January 12, 2021 23:12
Subject:
Re: local %SIG = (%SIG, $signame => ...) not working as expected?
Message ID:
cc3c13a8-a7ce-3a39-e6cc-d219f454237b@stemsystems.com
On 1/12/21 6:08 PM, Eric Wong wrote:
> local @SIG{keys %sig} = values %sig;
>> I do this sort of thing a lot when I want to localize a variable subset
>> of elements, using a hash slice or array slice as relevant.
> Cool, thanks, I will use that.  I did not realize keys and
> values ordering would be consistent there.

that is documented and used all the time by me and many others. they use 
the same internal iterator in the hash so the ordering is always the same.

uri



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