in reply to Re: Edit html files in directory
in thread Edit html files in directory

I think johnlawrence is correct here, the problem is that you are trying to open everything returned by readdir(), which will include the current and parent directories, not just the plain files.

It would be clearer, though, if you gave us the complete output. Can you tell which die() statement it failed on? (This is a good reason for making the message text from die() action specific -- if it dies trying to open a file for reading, say so. die "Can't open $file for reading: $!" and die "Can't open $file for writing: $!" make it a lot easier to tell just where it died.)