Can you provide a sample of the input date and explain what the output should be. In the meantime this is my guess at what you are trying to achieve.

#!perl use strict; my $axis; my %output; while (<DATA>){ my ($null,$x,$y,$z,$xb,$yb,$zb,$tp,$f1,$f2) = split ',',$_; next unless defined($f2) ; #skip incomplete line if (($x<10) && ($y<10) && ($z<10)){ $axis = 'bias'; } # Bias elsif ($x>30){ $axis = "x"; } # X elsif ($y>30){ $axis = "y"; } # Y elsif ($z>30){ $axis = "z"; } # Z else { next; } # Temperature if (($tp<45) && ($tp>35)){ $output{$axis}{40} .= $_; } #-40 elsif (($tp<25) && ($tp>15)){ $output{$axis}{20} .= $_; } #+20 elsif (($tp<85) && ($tp>75)){ $output{$axis}{80} .= $_; } #+80 } foreach my $axis (sort keys %output) { open my $fh, '>', $axis.'.txt'; print "Creating $axis.txt \n"; foreach my $temp (sort keys %{$output{$axis}}) { print $fh $output{$axis}{$temp}; } } #$null,$x,$y,$z,$xb,$yb,$zb,$tp,$f1,$f2 __DATA__ ,1,2,3,4,5,6,21,8,9 ,31,2,3,4,5,6,22,8,9 ,1,32,3,4,5,6,23,8,9 ,1,2,33,4,5,6,24,8,9 ,1,2,3,4,5,6,41,8,9 ,31,2,3,4,5,6,42,8,9 ,1,32,3,4,5,6,43,8,9 ,1,2,33,4,5,6,44,8,9 ,1,2,3,4,5,6,81,8,9 ,31,2,3,4,5,6,82,8,9 ,1,32,3,4,5,6,83,8,9 ,1,2,33,4,5,6,84,8,9
poj

In reply to Re: Printing out an Array of an Array... by poj
in thread 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.