I think putting command-line switches into the she-bang is not one of the better ideas, I doubt it's portable.
HaukeX just offered an alternative special variable, which even has a full English name $INPLACE_EDIT which is also self documenting.
And you've rather got bitten here by the effects of slurping the whole file into an array which is often a dangerous idea, because the size might be huge. I prefer lazy iteration by working line by line, whenever possible.
And making a full copy in RAM first is rather the strategy when you intend to directly replace the content in the filesystem, so you somehow doubled the efforts to a paradox effect.
Just my 2 cents ... :)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^3: Command Switch -i prints to screen not file
by LanX
in thread Command Switch -i prints to screen not file
by BillKSmith
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |