Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: Skip 21 Lines

by virtualsue (Vicar)
on Apr 24, 2001 at 23:02 UTC ( [id://75202]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Skip 21 Lines
in thread Skip 21 Lines

last unless 1..21;

Won't this do the opposite of what was intended and skip all but the first 21 lines of the file?

Replies are listed 'Best First'.
Re: Re: Re: Re: Skip 21 Lines
by suaveant (Parson) on Apr 24, 2001 at 23:06 UTC
    No... the while goes through 21 one times, then breaks out... (tho might lose line 22... 1..20 might be needed in this case... but once it exits the loop you either start a new loop or read the reast into an array or whatever, since your placeholder in the file is now at line 22. You see? But that way it isnt perfoming the line check after the 21st line.. not a big efficiency savings... but a bit.
                    - Ant
      OK, I see what you mean. I read it too fast the first time and thought your "rest of processing" bit was inside the first while(). My bad. Yes, you'd need 1..20 for this technique to work.

      I didn't see this response due to a config problem on my part. Now I know what "some notes below your chosen depth" means, sort of. I had not set a depth and assumed that I would see all responses in a thread. Apparently not.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-25 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found