The chomp() function removes the last NEWLINE (\n) character of each item Scalar context $foo = "Hello\n"; chomp( $foo ); # $foo is now "Hello" List context @foo = ( "Goodbye\n", "cruell", "world\n" ); chomp( @foo ); # @foo is now ( "Goodbye", "cruell", "world" ) Notice chomp does NOT remove more than "\n" characters!