Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Map list of hashrefs

by raybies (Chaplain)
on Nov 22, 2011 at 13:05 UTC ( #939449=note: print w/replies, xml ) Need Help??


in reply to Map list of hashrefs

If you don't mind an array of hash rather than three seperate hashes with independent names, I'd do this:
my @array = map { { k => $_ } } qw (val1 val2 val3);

(then accessing val1 and val2 would be... etc...)

 print "$array[0]->{k} $array[1]->{k}";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939449]
help
Chatterbox?
[erix]: in this context, one learns all kinds of interesting psychological excuse-jargon: not just 'alternative facts'; how about 'gapped knowledge' ? :)
[erix]: which still manages to sound more or less positive
[Corion]: Huh. I wasn't aware that you cannot segregate Python 2 and Python 3 modules... Hopefully Perl 6 module use C6AN and thus avoid the problem...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2017-01-24 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (203 votes). Check out past polls.