Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by fruiture (Curate)
on Oct 10, 2002 at 18:36 UTC ( [id://204271]=note: print w/replies, xml ) Need Help??


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

1. Use a flag. 2. If you read a file as you mentioned, do not use arrays at all:

open my $fh,'<', $filename or die $!; my $flag; while( <$fh> ){ unless( $flag ){ next unless /^start_mark/; $flag = 1; } elsif( /^end_mark/ ){ $flag = 0; } } continue { print if $flag } close $fh;
--
http://fruiture.de

Log In?
Username:
Password:

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

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

    No recent polls found