in reply to Re^2: Special behavior for LF and CR in RegExs?
in thread Special behavior for LF and CR in RegExs?
Well, $/ is the input record separator; generally, in strings and patterns, \n is magically mapped to that behind the scenes – even if it consists of multiple characters on the platform in question, such as CR/LF on DOS.
Basically, using \n will always work so long as the data you’re processing comes from the same platform that you’re running on. If not, you’ll need to convert end-of-line markers. There’s no way to avoid this.
So outside specific scenarios, you should use \n or $/ and let Perl handle the specifics. That will also yield the most portable scripts.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Special behavior for LF and CR in RegExs? (Ah! No!!)
by tye (Sage) on Jan 05, 2006 at 05:31 UTC | |
by Aristotle (Chancellor) on Jan 05, 2006 at 12:50 UTC |