You're right. But in my job, I often process DOS files on Linux server, thus 
I learned to be extremely careful with line endings :)

On Friday 01 June 2001 15:15, Randal L. Schwartz wrote:
> >>>>> "Ondrej" == Ondrej Par <[EMAIL PROTECTED]> writes:
>
> Ondrej> On Thursday 31 May 2001 22:30, Ken wrote:
> >> If you're reading this input from a file maybe try using a chomp?
>
> Ondrej> chomp isn't always good. It's better to use
> Ondrej> s/\r?\n?$//;
>
> Ondrej> or even
> Ondrej> s/\s*$//;
>
> Let's not introduce FUD unnecessarily.  chomp() is fine when you are
> dealing with intra-platform files, as it always deletes exactly the
> native line endings.
>
> Yours is a more general, and MUCH SLOWER solution, and should be
> invoked only when you suspect (or know) that some of the files may
> have come from other platforms with other line endings.  I consider
> that "better to use" only for some very specific values of "better".
> Let's not cargo-cult this.

-- 
Ondrej Par
Internet Securities
Software Engineer
e-mail: [EMAIL PROTECTED]
Phone: +420 2 222 543 45 ext. 112

Reply via email to