Hi all, thanks to all those that helped with my previous post.
My problem now is I always seem to only read the first line of my data file. I need to read the file 8 times (I know this is not ideal) and compare the variable $Pos against the first field in each line of data ($NewPos)
my @Column_Info = ( [ 1024, 1067 ], # Column 1 start stop [ 1068, 1093 ], # Column 2 start stop [ 1094, 1137 ], # Column 3 start stop [ 1138, 1163 ], # Column 4 start stop [ 1164, 1207 ], # Column 5 start stop [ 1208, 1233 ], # Column 6 start stop [ 1234, 1277 ], # Column 7 start stop [ 1278, 1321 ] ); # Column 8 start stop <snip> open(IN,"cat /tmp/show_library.$$|"); while (<IN>) { while ($Pos <= $EndPos) { $_ =~ s/^ //; chomp; printf "DEBUG: String: '%s', Position: %d, New Position: %d, Label: %s +\n", $_, $Pos, $NewPos, $NewLabel; if ($Pos == 1024) { printf "%s Diag tape\n", $Pos; $Library[$Count][$Column_Count] = $_; } else { ($NewPos, $NewLabel) = split(' ', $_, 9999); printf "DEBUG: String: '%s', Position: %d, New Position: %d, Label: %s +\n", $_, $Pos, $NewPos, $NewLabel; <snip> } $Column_Count++; $Pos++; } }
Any ideas where I am going wrong here?
TIA
CC

In reply to Problem reading data file by coec

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.