Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Big paregraphs in Perl

by Eily (Monsignor)
on Jun 21, 2013 at 15:21 UTC ( [id://1040190]=note: print w/replies, xml ) Need Help??


in reply to Big paregraphs in Perl

As irah said, processing the document line by line could be a good idea. But there's probably no problem with doing otherwise.

A Perl "trick" you may find useful is changing your script definition of what a line is, for exemple you could read your input file paragraph by paragraph instead of line by line, if a single line isn't enough information for you to work with. Check the documentation on $/ for that. For example, if your paragraphs are separated by a ----- line you could write :

{ local $/ = "\n-----\n"; # We make sure to localize the reading behav +iour to the inner block while(my $paragraph = <$yourInputFile>) { # code that processes the data } } # At this point we go back to a normal reading behaviour

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2026-01-23 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (125 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.