In Perl, chomp() removes the trailing newline character (usually from input) only if present, leaving other characters intact. chop() always removes and returns the last character regardless of what it is, which can be problematic if used on strings without a trailing newline. Chomp is the safer choice for cleaning input.