in reply to Re^4: Perl prints junk before file
in thread Perl prints junk before file

Yup this was the problem. It works now. Thank you!!

So which editor was it that confused you by adding BOM?

Because it wasn't perl :)