What happens when you try to do this? perl -i.bak -pe 1 alpha/bar Well, you seem to think you shouldn't be able to rename it because it's mode 0555, readonly. But that's irrelevant. It's the diretory that matters. So it succeeds.