for ($i = 0; $i < @blat_data; $i++) { my @splitted_row = split /\t/, $blat_data [$i]; my $query_id = $splitted_row[9]; if ($query_id eq $query_id_alt) { $count++; } else { $query_id_alt = $query_id; $count = 0; } $score = (($splitted_row[0] + ($splitted_row[2]>>1)) - $splitted_row[1] - $splitted_row[4] - $splitted_row[6]); #score = (match + (repMatch>>1)) - misMatch - qGapCount - tGapCount $hashref->{$query_id}->[$count] = $score; #reference on score } for (keys %$hashref) { $query = $_; $hashref->{$query}->[$idxMax] > $hashref->{$query}->[$_] or $idxMax = $_ for 1 .. @$#hashref->{$query}; #finds the index of the biggest array element print "Hello World\n"; }