Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 romping around the Monastery: (13)
As of 2014-07-14 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (259 votes), past polls