use strict; use warnings; my $header = ; while (my $line = ) { chomp $line; my @array = split /;/, $line, -1; my $row_id = shift @array; my @sorted = sort {$b<=>$a} @array; my $max = shift @sorted; my @index = map {$_ + 1} grep { $array[$_] eq $max } 0..$#array; print "Max value in the row $row_id is $max "; print "in the column(s) ", @index > 1 ? join ',', @index : @index, ".\n"; } __DATA__ row_id;value1;value2;value3 id001;10;10;30 id002;30;20;50 id003;30;80;10 id004;30;90;90 id005;50;50;10