in reply to dividing numbers

Well, just to show the Power of Perl, you could replace the entire contents of your foreach(my $protein=$seq->seq){ loop with:

my %count; $count{$_}++ for map uc, split '', $protein; for ( 'A' .. 'Z' ) { say RESULT "$_: ", $count{$_} / length $protein if $count{$_}; }