Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: File parsing-again

by Aragorn (Curate)
on Jun 30, 2004 at 15:06 UTC ( #370777=note: print w/replies, xml ) Need Help??


in reply to File parsing-again

Maybe this helps:
#!/usr/local/bin/perl use strict; use warnings; my @ctx_starters = qw(start1 start3); while (my $line = <DATA>) { if (grep { $line =~ /$_/ } @ctx_starters) { print $line; INNER: while ($line = <DATA>) { next INNER if $line !~ /^end/; print $line; last INNER; } } else { print $line; } } __DATA__ start1 foo bar end start2 baz quux end start3 bla bla end start4 hmm end start5 last one here end
Arjen

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://370777]
help
Chatterbox?
[talexb]: Hmm .. fascinated to learn that there's no INT function in SQL Server, only FLOOR and CEIL. #interestingjobint erviewquestion
[Corion]: talexb: How about convert( decimal( 10,0 ), EXPR )) ? ;-D
[Corion]: On the upside, $work has published two openings for cow-orkers; we'll see whether someone wants to work here ;)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2017-08-16 13:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (265 votes). Check out past polls.

    Notices?