in reply to Re: Best way to write in Perl
in thread Best way to write in Perl

I think you forgot to create a backup of the file. I tried:

perl -pi -e 's/MONK/SAINT/ig abc.txt

and get:

Can't do inplace edit without backup.

If you change that to:

perl -pib -e 's/MONK/SAINT/ig' abc.txt

Then it works ;)


Smoothie, smoothie, hundre prosent naturlig!

Replies are listed 'Best First'.
Re^3: Best way to write in Perl
by Prof Vince (Friar) on Sep 04, 2007 at 11:54 UTC
    Actually, just specifying -i will work on most platforms. Cf perldiag :
    Can’t do inplace edit without backup (F) You’re on a system such as MS-DOS that gets confused if + you try reading from a deleted (but still opened) file. You have t +o say "-i.bak", or some such.