in reply to How to remove Newline
Remove the new lines from your input. For the sample code you can do it using $data =~ s/\n//; before the print line.