in reply to Perl prints junk before file

Try this (I can gaurantee that the junk characters will disappear):
unlink('2.pl');

...together with the file...