Examples Assume that $str contains "hello world!\n". chomp $str; # $str contains "hello world!" chomp $str; # $str contains "hello world!" chop $str; # $str contains "hello world" print $string; # prints "hello world"