Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Answer: How do I handle mid-line carriage returns in a flatfile database?

( #48949=categorized answer: print w/ replies, xml ) Need Help??

Q&A > regular expressions > How do I handle mid-line carriage returns in a flatfile database? contributed by Anonymous Monk

There's a whole bunch of stuff in the FAQ about matching over more than one line, like the /s modifier for the end of a regular expression, which means "the stuff you find doesn't have to be on the same line".

It also say that if you set $/ = '' then Perl will read in paragraphs at a time, not lines at a time.

Does that help?

But obviously, killing the carriage returns on the way in to your program is going to solve it. The equivalent to the $/ = '' thing above is surely to

* replace all double returns with a holding pattern like ||||

* replace all single returns with spaces

* replace all |||| with returns

Comment on Answer: How do I handle mid-line carriage returns in a flatfile database?
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2015-07-05 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls