>>>>> "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.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to