We don't bite newbies here... much | |
PerlMonks |
Re: How do I select first string of a two dimensional array to compare to other values?by sundialsvc4 (Abbot) |
on Aug 31, 2015 at 01:34 UTC ( [id://1140489]=note: print w/replies, xml ) | Need Help?? |
It certainly looks to me that the print statement is within the while loop, such that it will print every value retrieved from the file-handle. You do need the loop, presumably, because you have a next if test to exclude certain lines. But, once you reach the point where the print statement is now located, you probably (instead ...) want to use a last statement to force a premature end to the while-loop: the first value is now in $first_value, and you do not wish to continue reading. After the } symbol which ends the while-loop, you can, if you like, put the print statement to see it. If, later on in the program, you start another while loop using the same file-handle, it should resume reading the file where it left off. (Unless you use fseek() to reposition it.) - - - (In the future, it will help us considerably if you’ll routinely tell us more information: a snippet of what the file looks like, and a brief description of what output you are seeing and why you feel that the output is wrong.) Meanwhile, Welcome to the Monastery!!
In Section
Seekers of Perl Wisdom
|
|