Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Map list of hashrefs

by davido (Archbishop)
on Nov 22, 2011 at 13:06 UTC ( #939450=note: print w/replies, xml ) Need Help??


in reply to Map list of hashrefs

The first generalization is to use an array instead of variable names with numbers in them. Then you could do this:

# Preserves any pre-existing anonymous hashref. @hr = map{ $hr[$_]->{k} = $val[$_] } 0 .. $#hr;

Bah! here instead. ;)

# Preserves any pre-existing anonymous hashref. $hr[$_]->{k} = $val[$_] for 0 .. $hr;

Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939450]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-10-21 14:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (270 votes). Check out past polls.

    Notices?