This isn't homework... But it might look that way. It's a project I'm working on for work.

This works OK but looks very inefficient... All the 'or' statements are mucking me up and I can't figure out a slicker way to do this. Take a look and see if you can do better (I'm sure at least some of you can). This is under use strict; and -w.

This code eats a text file and spits out values for each of the variables at one minute intervals, using UNIX time. The parsing is nice, this is the ugly bit - the output.

# Figure out the first timestamp foreach my $bar (sort keys %master) { $j = $bar; last; } # Figure out the last timestamp foreach my $bar (reverse sort keys %master) { $l = $bar; last; } do { my $out; $out .= "$j,"; $out .= $master{$j}{'CCMT'} || '0'; $out .= ","; $out .= $master{$j}{'CCOA'} || '0'; $out .= ","; $out .= $master{$j}{'CDEC'} || '0'; $out .= ","; $out .= $master{$j}{'CFST'} || '0'; $out .= ","; $out .= $master{$j}{'CREF'} || '0'; $out .= ","; $out .= $master{$j}{'CRSP'} || '0'; $out .= ","; $out .= $master{$j}{'CVEH'} || '0'; $out .= "\n"; print $out; $j += 60; } while $j <= $l;

In reply to Golf, Anyone? Stupid output questions 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.