|Keep It Simple, Stupid|
Thanks for reading my post and taking the trouble to reply.
I did show you exactly how I populated $filename of course:
but I expect you meant how I populated @files, which was using readdir
I didn't think that was important, since I specifically said I'd checked the file existed and I even posted some of its contents. And the fact that the loop works for all the other files in that directory is a strong hint there's no whitespace problems or whatever.
But the fact that you got a similar error with a non-existent file suggests to me that the problem is in the module, which was why I looked for <head/> in /usr/lib/perl5. So I'll go and look further to see if I can isolate where that string is coming from.
While I appreciate the benefits of SSCCE, I think the effort I would need to construct one in this case outweighs the benefits. But I may do so if I'm still stuck after a while.
PS Why does perlmonks format code at column 70? I could vaguely understand column 72 if I was a punched-card FORTRAN programmer but I use an 80-column terminal and try to stay within that!