Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Processing lines after a pattern in a while loop

by ysth (Canon)
on Apr 05, 2004 at 16:37 UTC ( #342677=note: print w/replies, xml ) Need Help??


in reply to Processing lines after a pattern in a while loop

.. in scalar context is a flipflop operator that does what you describe like this:
while (<DATA>) { # skip everything from line 1 to the #cardtype line unless (1../^#cardtype$/) { # we're past the junk } }
It works by returning true once the first condition is met (where the constant 1 here is implicitly compared to the current input line number) and continues to return true until the second condition is met. See perldoc perlop for more information.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2023-11-30 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?