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.";
In reply to Re^2: chop vs chomp
by sauoq
in thread chop vs chomp
by xoombot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |