in reply to Re^2: Command Switch -i prints to screen not file
in thread Command Switch -i prints to screen not file
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Command Switch -i prints to screen not file
by hippo (Archbishop) on Dec 29, 2020 at 23:19 UTC | |
by LanX (Saint) on Dec 30, 2020 at 00:29 UTC |