Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Handling A File In Human-Compatible Chunks

by BrowserUk (Patriarch)
on Jun 27, 2005 at 11:59 UTC ( [id://470228]=note: print w/replies, xml ) Need Help??


in reply to Handling A File In Human-Compatible Chunks

Setting local $/ = ''; # paragraph mode will cause each use of <FH> or readline to return a 'paragraph' of text from the file, where a paragraph is defined as block of text delimited by 1 or more blank lines.

Paragraph mode is described breifly (and rather confusingly) in perlvar under the description for the $INPUT_RECORD_SEPARATOR.

Setting it to "\n\n" means something slightly different than setting to "", if the file contains consecutive empty lines. Setting to "" will treat two or more consecutive empty lines as a single empty line. Setting to "\n\n" will blindly assume that the next input character belongs to the next paragraph, even if it's a newline.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-24 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found