Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: extract range from array of data

by QuillMeantTen (Friar)
on Dec 26, 2015 at 12:44 UTC ( #1151191=note: print w/replies, xml ) Need Help??


in reply to extract range from array of data

Greetings,
First, loading it all inside an array might not be a good idea, if its a very large file you are asking for trouble, why not read it line by line until you reach start, save the lines until you read end and close the file at that time?

Replies are listed 'Best First'.
Re^2: extract range from array of data
by AnomalousMonk (Bishop) on Dec 26, 2015 at 21:57 UTC

    There's a discussion of this approach in perlfaq6: "How can I pull out lines between two patterns that are themselves on different lines?" — even a one-liner! See also the discussion of the scalar context  .. flip-flop operator in Range Operators (scalar context sub-section) in perlop (some examples of what you want there also). (Update: See also Flipin good, or a total flop?, also with code that's almost exactly what theleftright seems to want.)


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-05-22 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (78 votes). Check out past polls.

    Notices?