develooper Front page | perl.perl5.porters | Postings from November 1999

[ID 19991119.003] chomp() can be confusing

Thread Next
From:
Ben_Tilly
Date:
November 19, 1999 07:26
Subject:
[ID 19991119.003] chomp() can be confusing
Message ID:
OF47CC4F38.CF9B333E-ON8525682E.0054550B@trepp.com
I have just talked to one too many people who have been bitten by this...

Is there any possibility of having Perl's chomp() command be modified to
recognize \n, \r, and \r\n as line-endings to chomp?  A source of nasty
confusion for people working in a cross-platform environment is when
identical Perl scripts give very different results on the same exact file
depending on whether you are running under *nix or Windows.  (Particularly
an issue with Samba because people wind up reading under one system files
created under the other.)

Yes, the current behaviour works as documented.  But it leads to code not
doing what people expect, and in many cases a confused person will spend
several hours confused...

Cheers,
Ben


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About