Perl 5 version 24.1 documentation
- chop( LIST )
Chops off the last character of a string and returns the character chopped. It is much more efficient than
s/.$//sbecause it neither scans nor copies the string. If VARIABLE is omitted, chops $_ . If VARIABLE is a hash, it chops the hash's values, but not its keys, resetting the each iterator in the process.
You can actually chop anything that's an lvalue, including an assignment.
If you chop a list, each element is chopped. Only the value of the last chop is returned.
See also chomp.