($var1) = (split(/\s+/, $strip))[0]; ($var2) = (split(/\s+/, $strip))[1]; ($var3) = (split(/\s+/, $strip))[2]; $line[0] = $var1; $line[1] = $var2; $line[2] = $var3;
Ugh. Why are you working with single values? split returns a list.
@line = split(/\s+/, $strip);
When you say
for ($i=0,$i<147,$i++)
the commas should be semicolons. Also, since all you want to do is iterate over indices 0 to 146, just say so:
for my $i (0 .. 146)
Much easier to read, no? And finally - Perl understands lists. Why use indices where you don't need to? That's rarely necessary and often a source of errors. Instead of
for ($j=0,$j<360,$j++) { $decavg2d[$i][$j] += $decavg[$i]; print "$decavg2d[$i][$j]\n"; }
it is better to say
for my $i (0 .. 146) { for (@decavg2d[$i][0 .. 359]) { $_ += $decavg[$i]; print "$_\n"; } }

Recommended reading: Mark-Jason Dominus' excellent Program Repair Shop and Red Flags article series on Perl.com.

Lastly - please get into the habit of using strict and warnings. It will save you a lot of headaches.

Makeshifts last the longest.


In reply to Re: Stupid loops, or is it just me? by Aristotle
in thread Stupid loops, or is it just me? by jkerwin

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.