Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

chop

Removes the last character from each argument. Returns the last character removed (from the final argument).

Unlike chomp, chop always removes exactly one character regardless of $/. Operates on each element when given an array. Returns the last character removed. Correctly handles multi-byte UTF-8 characters.

Synopsis

$char = chop($var);
$char = chop(@list);
chop $var;

See Also

chomp