Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How do you move within an array using foreach?

by rir (Vicar)
on Oct 10, 2002 at 18:58 UTC ( [id://204287]=note: print w/replies, xml ) Need Help??


in reply to How do you move within an array using foreach?

I'm not sure whether you want your foo line or not.
But this will do for small sets.
#!/usr/bin/perl use strict; use warnings; foreach (<DATA>) { if ( /begin/ .. /end/) { if ( /begin/ ) { print "You want to skip me, yes? $_"; next; } print; next; } } __END__ 1 2 3 4 begin 6 7 end 9

Log In?
Username:
Password:

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

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

    No recent polls found