Maybe I'm wrong, but I think that you are experiencing problems with the encoding of the end of line in your html file. Is your html file written in dos/Windows?, i.e has '\r\n' at the end of each line?. Are you processing it in *nix ('\n'). That would explain why you are seeing those ^M characters in vim. If that is true, Tie::File is seeing the whole file as just one line, and inserting your $line at the end of that unique line
You can see how many lines Tie::File is seeing with print $#testarray
Try one of the following (not both!):
Hope this helps
CitromatikIn reply to Re: Tie::file and html vs dos
by citromatik
in thread Tie::file and html vs dos
by Flubb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |