A Perl function which chops off the last character of a string and returns that character.

If all you want to do is remove the trailing newline, you might be better off using chomp.

If you chop a list, everything in the list gets chopped.

Chop is equivalent to substr($foo, -1, 1, "");