No that is not what I wanted I found that out anyways thanks { local(@ARGV)=($filename); local($^I)=".BAK"; while(<>){ if(....){ s/$oldvar/$newvar/; } print; } }
On Tue, 2004-06-15 at 19:02, Stephan Hochhaus wrote: > Am 15.06.2004 um 12:48 schrieb Ramprasad A Padmanabhan: > > > I want to open a file using a perl script and change a particular > > variable in it. > I would use the method James described. But if you absolutely have to > open a file in read & write mode you can use this: > > open (FILE, "+<filename.ext"); > > this will open your file for writing and reading > > You could also use > open (FILE, "+>filename.ext"); > but this will erase the contents of a file. > > Stephan > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>