Simon Cozens <[EMAIL PROTECTED]> writes:
>On Sun, Jan 28, 2001 at 01:06:31AM +0100, [EMAIL PROTECTED] wrote:
>> I don't think there are any good examples. If there were any good
>> examples, it would mean chop would be a useful function to have.
>> But after the arrival of chomp, they only reason to keep chop is backwards
>> compatability.
>
>chomp gets rid of what my system calls newlines. chop gets rid of newlines
>in data that comes from other systems too.
chomp gets rid of $/ - $/ may not be newline.
The other classic chop case might be:
foreach my $val (@list)
{
$string .= "$_,";
}
chop($string); # loose last ','.
Now that case may be better written
$string = join(',',@list);
but with more complex guts of for loop it can make sense.
--
Nick Ing-Simmons