On Fri, 13 Sep 2002, Ramprasad A Padmanabhan wrote: > I wrote a simple sedfiles script that would replace one string with > another in all specified files > > It works fine only thing is that it creates extra ~ files after running > Can I avoid them. It is not that bad anyway I can live with it > > > here is my script: > > #!/usr/bin/perl > die "Usage $0 <srcstring> <deststring> <file1>..<file2>\n" unless (@ARGV > > 2 ); > > $srcstr = shift(@ARGV); > $deststr = shift(@ARGV); > > { > > local $^I = '~';
This is the flag to enable in-place edit, perldoc perlvar Also look into the -i switch in perldoc perlrun To avoid these ~ files do this local $^I = ''; > while (<>) { > s/\Q$srcstr\E/$deststr/g; > print; > } > } > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]