Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Localizing hash keys in an AoH

by kennethk (Abbot)
on Mar 15, 2013 at 22:18 UTC ( #1023785=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Localizing hash keys in an AoH
in thread Localizing hash keys in an AoH

Localizing the array slice seems to work, which is weird because localizing the array did not -- see Re^2: Localizing hash keys in an AoH. Huh. Regardless, thank you! Just what the doctor ordered.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re^3: Localizing hash keys in an AoH
Replies are listed 'Best First'.
Re^4: Localizing hash keys in an AoH
by NetWallah (Abbot) on Mar 16, 2013 at 03:11 UTC
    Looks like you can do all that in a single line as well:
    perl -E 'use strict;my @x=map {Z=>$_+999}, 0..5;{$_->{Z}=33 for local + @x[0..$#x]; say $x[2]{Z}}; say $x[2]{Z}' 33 1001

                 "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
            -- Dr. Cox, Scrubs

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023785]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2015-07-30 03:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls