in reply to String differs from printing to STDOUT and printing to file
To combine the points that rjt and GrandFather made, it'd be best if you inspect your string with Devel::Peek and your file with hexdump; I gave an example here.
<shameless plug>Data::Peek combines the two without hexdump or od installed:</shameless plug>
$ perl -MData::Peek -we'my $pw = "QeTEv2804\c@\c@\c@"; DPeek $pw; DDis
+play $pw; DHexDump $pw'
0000 51 65 54 45 76 32 38 30 34 00 00 00 QeTEv2804...
www.com | www.net | www.org
No recent polls found