Name

chop

Synopsis

chop $var
chop @list
                  

Chops off the last character of a string contained in the variable $ var (or strings in each element of a @ list) and returns the character chopped. The chop operator is used primarily to remove the newline from the end of an input record but is more efficient than s/\n$//. If no argument is given, the function chops the $_ variable.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.