Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Need to skip two lines

by codeacrobat (Chaplain)
on May 06, 2009 at 05:52 UTC ( #762168=note: print w/replies, xml ) Need Help??


in reply to Re: Need to skip two lines
in thread Need to skip two lines

This is how you skip lines without affecting the rest of the outer while loop.
while(<DATA>){ if (/2/){ my $skip=2; print "skipping $skip lines\n"; <DATA> while $skip-- >0 and not eof DATA; next; } if (/5/){ print "high five\n"; next; } if (/3/){ print "I am not here\n"; next; } print; } __DATA__ 1 1 2 3 4 4 5

print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2021-09-24 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?