Like this?:

Perhaps this is closer to what you are after (Updated: corrected output ordering):

#! perl -slw use strict; use Data::Dump qw[ pp ]; my @freq; my @data = qw[ AABBC BAABC AABBD AACBB ]; for my $s ( @data ) { ++$freq[ $_ ]{ substr $s, $_, 1 } for 0 .. length( $s ) -1; } ##pp \@freq; for my $pos ( @freq ) { ( $pos->{ $_ } //= 0 ) /= 4 for 'A' .. 'D'; } ##pp \@freq; print join "\t", '', 'A'..'D'; for my $pos ( 0 .. $#freq ) { printf "%2d\t%s\n", $pos+1, join "\t", map sprintf("%.2f", $_ ), + @{ $freq[ $pos ] }{ 'A' .. 'D' }; } __DATA__ C:\test>1162755 A B C D 1 0.75 0.25 0.00 0.00 2 1.00 0.00 0.00 0.00 3 0.25 0.50 0.25 0.00 4 0.00 1.00 0.00 0.00 5 0.00 0.25 0.50 0.25

Another variations that doesn't hard code the keys:

#! perl -slw use strict; use Data::Dump qw[ pp ]; my( @freq, %c, $c ); #my @data = qw[ AABBC BAABC AABBD AACBB ]; my @data = qw[ AABBC BAABC AABBD AECBBF ]; for my $s ( @data ) { ++$freq[ $_ ]{ $c = substr $s, $_, 1 }, undef $c{ $c } for 0 .. le +ngth( $s ) -1; } ##pp \@freq; my @oK = sort keys %c; for my $pos ( @freq ) { ( $pos->{ $_ } //= 0 ) /= 4 for @oK; } ##pp \@freq; print join "\t", '', @oK; for my $pos ( 0 .. $#freq ) { printf "%2d\t%s\n", $pos+1, join "\t", map sprintf("%.2f", $_ ), + @{ $freq[ $pos ] }{ @oK }; } __DATA__ C:\test>1162755 A B C D E F 1 0.75 0.25 0.00 0.00 0.00 0.00 2 0.75 0.00 0.00 0.00 0.25 0.00 3 0.25 0.50 0.25 0.00 0.00 0.00 4 0.00 1.00 0.00 0.00 0.00 0.00 5 0.00 0.25 0.50 0.25 0.00 0.00 6 0.00 0.00 0.00 0.00 0.00 0.25

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Tallying overall frequency of characters in a set of strings by position by BrowserUk
in thread Tallying overall frequency of characters in a set of strings by position by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.