Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Find column number for the row-wise max value

by LanX (Saint)
on Feb 29, 2012 at 16:10 UTC ( [id://956967]=note: print w/replies, xml ) Need Help??


in reply to Find column number for the row-wise max value

Just for fun with Schwartzian transform and expensive sort!

DB<109> $txt='id003;30;80;10' DB<110> local $.=0; @sort = sort {$a->[0] <=> $b->[0]} map { [$_ => +$.++] } split /;/, $txt DB<111> print $sort[-1]->[1] 2

Was to lazy to eliminate the id field first. :)

Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-03-19 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found