in reply to Re: help declaring variables within perl one-liner
in thread help declaring variables within perl one-liner

Now, one would also quite reasonably argue that one shouldn't execute perl either. However, -i is quite good at avoiding data loss (due to recent improvements), and recreating this wouldn't be trivial.

$^I

  • Comment on Re^2: help declaring variables within perl one-liner

Replies are listed 'Best First'.
Re^3: help declaring variables within perl one-liner
by ikegami (Patriarch) on Apr 01, 2021 at 20:08 UTC

    For some reason, I thought you could only use that once per program. That's not true.

    $ printf 'foo\nbar\n' >file $ perl -e' for (1..2) { local @ARGV = qw( file ); local $^I = ""; print ">$_" while <>; } ' $ cat file >>foo >>bar

    Seeking work! You can reach me at ikegami@adaelis.com