in reply to Can you teach a new dog an old trick?
It's such a common idiom that the -p and -i command-line flags were invented to deal with it:
#!/usr/bin/perl -wpi s/string1/string2/g;
And then you'd run it as: myScript *.htm
update: note that the contents of a script run with -p or -n are inside a loop. If you want to initialize anything before the loop, use a BEGIN or INIT block.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Can you teach a new dog an old trick?
by PetaMem (Priest) on Jul 29, 2001 at 12:43 UTC | |
by mugwumpjism (Hermit) on Jul 29, 2001 at 16:14 UTC |
In Section
Seekers of Perl Wisdom