> Hi ,
>
> How do I search replace text in a file from a perl script. i.e. by
> opening the file in write mode and then do a search replace.
>
> I don't want to do a command line search replace.

Use the s/// operator...as follows:

$_ =~ s/oldtext/newtext/gi;

this will replace all occurrences of "oldtext" with "newtext".

You should visit the perlfunc at perl.com to get all of the variables and
syntax of s///

HTH

Perlwannabe



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to