Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Reading a part of text file between markers

by manav (Scribe)
on Mar 28, 2005 at 16:56 UTC ( [id://442864]=note: print w/replies, xml ) Need Help??


in reply to Reading a part of text file between markers

You can use the .. operator like
use strict ; use warnings ; my $rule=1 ; while(<DATA>) { if(/RULE=$rule/../^END$/) { print } }
This will only print data for RULE=1. Inside the if loop, you can do whatever you'd like with $_.


Manav

Log In?
Username:
Password:

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

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

    No recent polls found