Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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

Replies are listed 'Best First'.
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?
[Corion]: Hi marto! Indeed, Crunchy be thanked!
choroba had a Christams party at work yesterday. Slow morning today...
[Corion]: I guess I should not read some discussions on HackerNews - the crowd there is weirdly different - "you have to stay current in tech" (by following all the latest JS trends) is a meme there, but it doesn't really match my experience
[Corion]: At least in my area, experience can beat most new tech anyway because most new tech is just a rehash of things abandoned in the 70s and we still have a lot of that ;)
[Corion]: choroba: Ah, that will be next Friday for $work ;) Drinking enough water is key ;))
[Corion]: But then, maybe that's just my experience with things, and maybe Hacker News is just people much younger who haven't seen more than one tech cycle...
[choroba]: s/water/bear/ and s/enough/too much/
[choroba]: beer
[choroba]: oh ok
[marto]: I crashed the ScotLUG Christmas night, having never actually been to ScotLUG

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2016-12-09 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.