in reply to Find all values of an AoA by columns

use strict; my @AoA = ( [ "X", "Z", "W", "X", "Z", "Z" ], [ "Z", "Z", "X", "X", "X", "W" ], [ "X", "Z", "X", "W", "W", "W" ], [ "Z", "X", "W", "X", "Z", "Z" ], [ "Z", "X", "W", "X", "X", "W" ], [ "Z", "X", "X", "X", "Z", "W" ], ); my @col; for my $row (@AoA){ $col[$_]{$row->[$_]}++ for 0..$#{$row}; } for my $v(@col){ my ($first,$second)= sort {$v->{$b} <=> $v->{$a}} keys %$v ; print ($v->{$first} eq $v->{$second} ? "A":$first, " "); } print "\n";
Prints:
Z A A X Z W

Update: Not sure what you meant by the 60% - perhaps this print replacement :

print ($v->{$first} == $v->{$second} || $v->{$first} < 0.6 * scalar(keys %$v) ? "A": $first, " ");

     Potentia vobiscum ! (Si hoc legere scis nimium eruditionis habes)