use strict; my @pmf; my $count = 0; while( my $seq = ) { $count++; chomp $seq; my @bases = split //, $seq; for my $i ( 0 .. $#bases ) { $pmf[ $i ]{ $bases[$i] }++; } } for my $i ( 0 .. $#pmf ) { printf "%3u: ", $i; for my $base ( qw{ A C G T } ) { printf "$base %3.0f, ", 100 * $pmf[ $i ]{ $base } / $count; } print "\n"; } __DATA__ ATTCATCTCTCGG ATTGTGAGATAGA AAGATGATCGCTC AGATAGATCGCTG