Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Stack table columns with hash of arrays

by jwkrahn (Abbot)
on May 31, 2011 at 09:08 UTC ( [id://907423]=note: print w/replies, xml ) Need Help??


in reply to Stack table columns with hash of arrays

$ echo "foo1 1 4 7 foo2 2 5 8 foo3 3 6 9" | perl -e' my @data; while ( <> ) { push @data, [ split ] } while ( @{ $data[ 0 ] } > 1 ) { print map "$_->[0]\t@{[ splice( @$_, 1, 1 ) ]}\n", @data } ' foo1 1 foo2 2 foo3 3 foo1 4 foo2 5 foo3 6 foo1 7 foo2 8 foo3 9

Replies are listed 'Best First'.
Re^2: Stack table columns with hash of arrays
by robertkraus (Novice) on May 31, 2011 at 09:27 UTC
    Wow! This works pretty neatly, too! No need for a hash, and actually cool because this means there is no issue with sorting. It comes out as it goes in. Cool stuff!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-24 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found