Perl Programming/Keywords/chomp

The chomp keyword
chomp is the safer version of chop that removes any trailing strings that corresponds to the current value of $/, which is also known as the $INPUT_RECORD_SEPARATOR in the English module, and returns the total number of characters removed from all arguments. In paragraph mode ($/ = "" ), all trailing newlines from the string are removed. In slurp mode ($/ = undef) or fixed-length record mode (<tt>$/</tt> is a reference to an integer or the like) <tt>chomp</tt> will not remove anything. If <tt>VARIABLE</tt> is omitted, it chomps <tt>$_</tt>. If <tt>VARIABLE</tt> is a hash, it chomps the values of the hash and not its keys, and resets the <tt>each</tt> iterator.