Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by JavaFan (Canon)
on Feb 29, 2012 at 15:58 UTC ( [id://956963]=note: print w/replies, xml ) Need Help??


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

Untested code:
my @max; for (my $n = 0; $n < @lines; $n++) { # Assume the rows are in @lines $values[$n] = [split /;/, $lines[$n]]; shift @values; for (my $i = 0; $i < @{$values[0]}; $i++) { if ($values[$i] >= $lines[$max[$i]||0][$i]) { $max[$i] = $n; } } } print "$_\n" for @max;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found