[Israel.pm] Pet Peeve
gaal at forum2.org
Mon Jan 21 07:43:01 PST 2008
Because chomp operates on whatever the input record separator is, so
that it does the right thing when you do perl -Osomething_else.
Unfortunately, $/ doesn't take a regexp, so you can't say "local $/ =
qr/\r?\n/" or something like that. This is where the funny comment
about awk is in perlvar.
On Jan 21, 2008 4:45 PM, Peter Gordon <peter at pg-consultants.com> wrote:
> And since I started, I have another suggestion.
> I normally work on Linux, and have to process files from from Other
> Operating Systems (tm), where the line ending is \r\n.
> Why can't chomp do what I want. Which is to say, delete either \r\n or
> \n - whatever happens to be at the end of the line. I know I can use a
> regex, but for something as simple as just removing line endings, one
> would have thought there would be a nicer way to do it.
> Perl mailing list
> Perl at perl.org.il
Gaal Yahas <gaal at forum2.org>
More information about the Perl