Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: sort based on column values

by bichonfrise74 (Vicar)
on Jun 22, 2009 at 21:33 UTC ( [id://773775]=note: print w/replies, xml ) Need Help??


in reply to sort based on column values

This is a good example to use the Schwartzian Transform.
#!/usr/bin/perl use strict; my $string; while( <DATA> ) { $string = $string . join " ", $_; } my $test = join "\n", map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, (split)[9]] } split( /\n/, $string); print $test; __DATA__ cng003 sfd009 61.7 654 231 4 654 1800 711811 876112 E-193 cng006 sfd009 87.5 556 341 0 165 491 6234 45112 E-145 cng009 sfd009 80.2 234 536 3 17 184 9812345 9923000 E-13

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-03-28 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found