in reply to In-place file manipulation

A sublime example for the use of the -i switch when using perl from the command line. See. perlrun for info on this marvellous switch (best used in conjunction with -p and -e).
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: In-place file manipulation
by perlguy (Deacon) on Apr 30, 2003 at 15:38 UTC

    I use this one all the time. A quick example of broquaint's suggested technique (from the command line), to replace all capitalization permutations of the word 'perl' to 'Perl' in file perl.pl, and store the original in perl.pl.bak:

    perl -pi.bak -e 's/\bperl\b/Perl/gi' perl.pl