Thanks for all the suggestions, folks. While that flip flop did work out as anticipated, it turns out thats not exactly what I thought I needed
What I ended up doing was sending all the data in the file to an array then incrementing the elements of that array in a for loop. Inside that for loop, I set a few triggers via a switch. Since the beginning value of each line tells me what sort of data it contains, I then split each line depending on what it was:
{{{vars}}} my $infile = <STDIN>; print"Your input file is $infile\n\n"; open (INFILE, "<$infile")||die "no such file"; while (<INFILE>) { @data = <INFILE>; for ($x = 0; $x<=$#data; $x++){ chomp ($data[$x]); switch ($data[$x]){ # If start of section, increment array by 3 to skip header # case /^Begin Targets/ { $x += 3; } case /^0 / { # do not want last; } case /^1 / { @line = split(/ /,$data[$x]); # Get data out last; } case /^2 / { @line = split(/ /,$data[$x]); # Get data out last; } case /^3 / { @line = split(/ /,$data[$x]); # Get data out last; } # end case3 } # end switch } # end for } #end
In each case I can take the line and set it to some variable depending on which place in the field I want,
$DistX[$x] = $line[2]; $DistY[$x] = $line[3];
...etc
Well Im half way there, Now I just need to output this data to a csv spreadsheet to plot it...but thats for tomorrow :)

In reply to Re^2: Looking for a good way to split a file into equal sized arrays by Luken8r
in thread Looking for a good way to split a file into equal sized arrays by Luken8r

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.