To get you started, a quick test under the debugger:
DB<24> $in = "0.4% 0.7% 1.1% 1.4% 1.8% 2.2% 2.5% 2.9% 3.3% 3.6% 4.0% + 4.3% 4.7% 5.1% 5.4% 5.8% 6.2% 6.5% 6.9% 7.2% 7.6% 8.0% 8.3% 8.7% 9.1 +% 9.4% 9.8% 10.1% 10.5% 10.9% 11.2<.3% 3.6% 4.0% 4.3% 4.7% 5.1% 5.4% +5.8% 6.2% 6.5% 6.9% 7.2% 7.6% 8.0% 8.3% 8.7% 9.1% 9.4% 9.8% 10.1% 10. +5% 10.9% 11.2%"; DB<25> $in =~ s/%//g; # remove the percentage signs DB<26> p $in 0.4 0.7 1.1 1.4 1.8 2.2 2.5 2.9 3.3 3.6 4.0 4.3 4.7 5.1 5.4 5.8 6.2 6 +.5 6.9 7.2 7.6 8.0 8.3 8.7 9.1 9.4 9.8 10.1 10.5 10.9 11.2 11.6 DB<26> @val = split /\s/, $in; DB<27> while ($i = shift @val and $i <= 10) {$sum += $i; $j++} DB<28> print $sum/$j; 5.07037037037037 DB<29> unshift @val, $i if $i > 10; # put back the last value into t +he array if needed
This might not be the best way for the final program, but it gives you basically the idea for one group of values. Then you need to create an array with the steps (10, 20, 30...100), for example:
DB<32> @steps = map $_ * 10, 1..10; DB<33> x \@steps 0 ARRAY(0x600639618) 0 10 1 20 2 30 3 40 4 50 5 60 6 70 7 80 8 90 9 100
and include the above process in another external loop going through the steps. Then you finally need yet another more external loop for going through the whole data.

I hope this helps you get going. If you understand the above, you can probably do the whole thing.


In reply to Re: Average columns based on header name by Laurent_R
in thread Average columns based on header name by jacobs.smith

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.