Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How to join values of the same key that is an array of hashes?

by Anonymous Monk
on Jan 05, 2014 at 04:18 UTC ( #1069347=note: print w/ replies, xml ) Need Help??


in reply to How to join values of the same key that is an array of hashes?

Or this:

use warnings; use strict; my %h; while (<DATA>) { my @cols = split; push @{ $h{ shift @cols } }, \@cols; } print $_, ' ', join( ' ' => map { $_->[0] } @{ $h{$_} } ), ' ', join( ' ' => map { $_->[1] } @{ $h{$_} } ), $/ for sort { $a cmp $b } keys %h; __DATA__ p1 cis 10 p1 plat 20 p1 gls NA p2 cis 0 p2 NA 9


Comment on Re: How to join values of the same key that is an array of hashes?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2014-07-25 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (172 votes), past polls