Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Perl: the Markov chain saw
 
PerlMonks  

Re: create 2-D array and then sort from max. to min.

by TedPride (Priest)
on Jul 15, 2010 at 19:07 UTC ( #849839=note: print w/ replies, xml ) Need Help??


in reply to create 2-D array and then sort from max. to min.

use Data::Dumper; use strict; my @arr; while (<DATA>) { s/\s+$//; push @arr, [split /\s+/, $_] if $_; } print Dumper(\@arr); @arr = sort { $b->[2] <=> $a->[2] } @arr; print Dumper(\@arr); __DATA__ A BBL 0.2 B BBH 0.3 C BB 0.1


Comment on Re: create 2-D array and then sort from max. to min.
Download Code
Re^2: create 2-D array and then sort from max. to min.
by 3dog (Initiate) on Jul 15, 2010 at 21:01 UTC
    works great! thanks a lot!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2014-04-21 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (490 votes), past polls