On May 24, David Blevins said:
>So, as far as editing files in a subroutine of a script, there does not seem
>to be an easier or more performant way?
>
>Would it be performant to call the perl command as a subprocess, as in:
>
>`perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile`;
You can make use of -i in your program:
{
local $^I = ""; # set to something like ".bak" for a backup
local @ARGV = "thefile"; # list of files to edit
while (<>) {
print unless /delete me/;
}
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** I need a publisher for my book "Learning Perl's Regular Expressions" **