http://www.perlmonks.org?node_id=1057355


in reply to Incorrectly adding a newline character

Try Chomping an array If you chomp an array, it will remove a newline from the end of every element in the array

So, try the blow code and tell what happens!

open (IN, $ARGV[0]); open (OUT, ">output.txt"); while ($line = <IN>){ chomp $line; @line=split/\t/,$line; chomp(@line); print OUT $line[1]."\t".$line[2]."\t".$line[2]."\n"; } close( OUT);

All is well