in reply to Hidden Newline in Result

If the file is from windows try changing the chomp to this

#chomp($line); $line =~ s/[\r\n]+$//g;
poj