Perl Programming/Keywords/chop

The chop keyword
The chop function chops off the last character of a string and returns it. It is much more efficient than s/.$//s, as it neither scans nor copies the string. Without VARIABLE, it chops $_. If VARIABLE is a hash, it chops the hash's values, not its keys, and resets the each iterator in the process.

If a list is chopped, each element is chopped off, but only the value of the last chop is returned. Note that chop returns the last character. To return all but the last character, substr($string, 0, -1) should be used.

Examples
The code