update: In the original node, I'm probably not as clear I should be that much of the second sub is ovid's
Yes, while the chomp better than the no chomp, it is not perfect. If the string is something like "asadf\r\n" and the OS is \r\n orriented, the chomp gives us "<p>asdf</p>" instead of "<p>asdf</p><p></p>". If we are processing the string on a \n orriented OS, We are out of luck...
If I understand perldoc perlre the "/s" or "!s" at the end of the regular expression means "Treat string as single line. "
However, in tadman's node, I'm not getting how s/\r\n//s ( or s!\r\n!!s ) means "take off the \r\n at the end of the string" ???
email: mandog
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.