Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by btrott (Parson)
on Mar 30, 2000 at 09:47 UTC ( [id://6513]=note: print w/replies, xml ) Need Help??


in reply to How do I handle mid-line carriage returns in a flatfile database?

I believe you should be able to just do something like this:
$entry =~ tr/\r//d;
This will strip every carriage return from $entry. Alternatively, you may wish to replace carriage returns with spaces (so that you don't get words running together):
$entry =~ tr/\r/ /;
I'd recommend the latter.

Replies are listed 'Best First'.
Re: Answer: How do I handle mid-line carriage returns in a flatfile database?
by Sol-Invictus (Scribe) on Feb 06, 2004 at 14:12 UTC
    I think it's worthwhile pointing out that "\n" really means the local end of line marker, local as in the computer the script is run on.

    This is not a fixed standard as the following shows:
    Unix/Linux/OSX use \012
    Win/DOS usually uses \015\012 for text IO

    So running a script under (Uni|Linu|OS)X containing  tr/\n// on a file written on windows won't behave the way you might think.

    You spend twenty years learning the spell that makes nude virgins appear in your bedroom, and then you're so poisoned by quicksilver fumes and half-blind from reading old grimoires that you can't remember what happens next.

Log In?
Username:
Password:

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

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

    No recent polls found