http://www.perlmonks.org?node_id=751195


in reply to chop and chomp

chop is used to remove the last character,chomp function removes only line endings.

chop removes the last character and returns the character chopped. Chomp removes any trailing string that corresponds to the current value of $/ and returns number of characters removed.

Replies are listed 'Best First'.
Re^2: chop and chomp
by ikegami (Patriarch) on Mar 17, 2009 at 14:04 UTC

    chomp function removes only line endings

    Only for a very specific definition of line endings. That's misleading. It won't even remove a Windows line ending (CRLF) on a Windows machine by default. Nor would you want it to do so.