Hi all,

I notice that String#chop is a little more intelligent 
than its Perl equivalent, in that, if the last character 
of the string is "\n", it checks whether the next-to-last 
character is "\r" and, if so, chops them both off.  This 
is a nice, transparent way to handle the different line 
separators used by different OS's.  What I'm wondering is, 
why doesn't String#chomp work the same way?  It's supposed 
to be the smarter of the two methods, but it just looks 
for the value of $/ (which, even on my Win98/cygwin setup, 
defaults to "\n"), and if it doesn't find it, does nothing.  

It seems to me that chomp should look for "\r\n", "\n" or 
"\r", in that order, regardless of the OS or the value of 
$/.  AFAIK, "\r", like "\n", is only ever used to separate 
lines, so there's no reason not to treat the three values 
above as equivalent.  Can someone tell me if I'm wrong?


--Alan