I am new to PERL. I am trying to create a loop to print out several text files created by the eslif switch. Each line from the input files are evaluated and then put in an array "bucket". I am trying to print out each array bucket with:

bias.txt has b40, b20, b80 x.txt has x40, x20, x80 y.txt has y40, y20, y80 z.txt has z40, z20, z80

Any suggestions are welcom. Thanks for looking

@ARGV = ("-40.txt", "+20.txt", "+80.txt");
while (<>) { ($null,$x,$y,$z,$xb,$yb,$zb,$tp,$f1,$f2) = split m!\+|\-|\s\+|\s\- +|\s!; if ($f2 == undef){next;} #skip incomplete line elsif (($x<10) && ($y<10) && ($z<10)){ $axis[0] = "b";} # Bias elsif ($x>30){ $axis[1] = "x";} # X elsif ($y>30){ $axis[2] = "y";} # Y elsif ($z>30){ $axis[3] = "z";} # Z # Temperature if (($tp<45) && ($tp>35)){$temp[0] = 40; $output[@axis][@temp] .= +$_;} #-40 elsif (($tp<25) && ($tp>15)){$temp[1] = 20; $output[@axis][@temp] +.= $_;} #+20 elsif (($tp<85) && ($tp>75)){$temp[2] = 80; $output[@axis][@temp] +.= $_;} #+80 } @file = qw(bias.txt x.txt y.txt z.txt); foreach $filename (@file) { open $fh, '>', $filename; foreach $temp (@{$output[$temp]}) { print $fh $output[$temp][$axis], "\n"; } $axis++; }

In reply to Printing out an Array of an Array... by rd48sec

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.