in reply to Re: chop vs chomp
in thread chop vs chomp

Both return what was taken off.

No, chomp returns the number of characters that were removed. As $/ can be more than 1 character, this value is not always 0 or 1. Example:

$ perl -le '$foo = "foo\r\n"; $/ = "\r\n"; print chomp $foo; print len +gth $foo' 2 3

Update: I should also mention that, when called with a list, chomp will return the sum of all characters removed from all members of the list.

-sauoq
"My two cents aren't worth a dime.";