in reply to Re: File editing
in thread File editing

First of all those die statements are very uninformative. At the least you should say the attempted action, the filename, and report the OS error with $!. For something this simple there is no reason to not just read from @ARGV with <>.

If you have ever had to get a broken script with useless error reporting working again at midnight when it turns out that someone (not me!) had been mucking around as root and left permissions wrong on one file in several thousand, you will appreciate why I am a stickler for this!

Secondly you will lose the end of the line with the RE, so you didn't quite answer the problem stated. OTOH I suspect that you did answer the question that really was meant.