There's a number of hidden factors here that make direct answers to your question mostly meaningless. Without more information, there's not a whole lot to go on.
- How was '2.pl' created? It is possible that some weird, or corrupted version of the BOM got inserted there.
- What do you mean by "this doesn't happen" - are you 'cat'ting the resulting file, opening and reading it the same way as '2.pl', reading it in a text editor, or what? Depending on the answer to that, the characters may still be there but be invisible.
- You _do_ realize that printing a file this way is generally not a good idea, right? Not particularly relevant in this case, but snarfing the entire content of an arbitrary-sized list is a good way to whack your memory.
Possible solutions:
- Try 'head -c 1 2.pl' to determine what, if anything, you have as the first character in your source file.
- Print the content to another file, then read that resulting file with the above script. See if that same thing happens. "bvi", "vim -b", or ':set list' in "vi" (or any other method of viewing the file raw) would be of help here.
- For Great Ghu's sake, put an ' or die' statement after your 'open'. It makes me nervous to see it sitting there naked and unprotected like that. :)
--
Education is not the filling of a pail, but the lighting of a fire.
-- W. B. Yeats