Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by strider corinth (Friar)
on Oct 10, 2002 at 18:32 UTC ( [id://204268]=note: print w/replies, xml ) Need Help??


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

I'd probably just use a flag variable:

my $flag = 0; foreach my $line( @lines ){ $flag = 1 if $line =~ m/\[foo\]/; $flag = 0 if $line =~ m/\[foo2\]/; print $line if $flag; }

--

Love justice; desire mercy.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-03-28 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found