Here's what I worked out. It does actually work even though it looks like crap and I'm sure one of you can probably cut out half of the code. Please feel free to show me a better way to do this.
open OUT, ">$Output_Directory/sitescope.dat" or die "Can't open OUTPUT + file: $!"; foreach (@data) { $counter++; @tmp = split(/\t/); ($time,$date) = split(/ /,$tmp[0]); $date =~ s/2003/03/g; $time = substr($time,0,5); $mday = substr($date,3,2); ($hour,$min) = split(/:/,$time); $mod = int($min/5); if ($mod != $last_mod) { print OUT "$last_date\.$last_time\t"; foreach (1..5) { $seconds = $seconds{$_}/$counter; printf OUT "%1.2f\t",$seconds; $seconds{$_}=0; } print OUT "\n"; $counter=0; } foreach (@tmp[1..5]) { $place++; $seconds{$place} += ($_/1000); } $place=0; $last_mod = $mod; $last_date = $date; $last_time = $time; } close OUT;
Original data:
08/08/03.07:55  1.61    1.158   0.71    0.209   0.535   
08/08/03.07:57  1.094   0.887   0.96    0.126   0.322   
08/08/03.07:59  5.131   0.986   1.029   0.095   0.251   
08/08/03.08:01  1.071   1.274   0.638   0.197   0.347   
08/08/03.08:03  1.166   0.984   0.598   0.092   0.583   

Chunked data:

08/08/03.07:59  2.39    0.94    0.80    0.11    0.30    
08/08/03.08:03  2.31    1.60    1.02    0.20    0.61    


In reply to Re: data manipulation by Earindil
in thread data manipulation by Earindil

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.