CHOP
‘chop’ function only removes the last character completely ‘from the scalar, where as ‘chomp’ function only removes the last character if it is a newline. by default,
CHOMP
chomp only removes what is currently defined as the $INPUT_RECORD_SEPARATOR.
whenever you call ‘chomp ‘, it checks the value of a special variable ‘$/’. whatever the value of ‘$/’ is eliminated from the scalar. by default the value of ‘$/’ is ‘n’