Problems? Is your data what you think it is? | |
PerlMonks |
Re: Return?by chromatic (Archbishop) |
on Apr 14, 2000 at 19:30 UTC ( [id://7635]=note: print w/replies, xml ) | Need Help?? |
A similar question is in ASCII to HTML. To answer your direct question, I would use:
$message =~ tr/\n\r//d;
This deletes any linefeeds or carriage returns. It's much more efficient than the s/// operator. If you want to format the text for display, you might use btrott's oneliner:
$message = join "\n<p>\n", grep s/\n/<br>\n/g || 1, split /\n\n/, $message;
In Section
Seekers of Perl Wisdom
|
|