Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to How do I select first string of a two dimensional array to compare to other values?

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!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1140489]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 22:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found