-i switch.
While this option is global for the script, it can be convenient to switch it on selectively.
Here is a code snippet from one of Randal Schwartz's columns:
{
local @ARGV = "lib/Acme/Current.pm";
local $^I = "~";
while (<>) {
s/\$YEAR = \d+, \$MONTH = \d+, \$DAY = \d+;/\$YEAR = $Y, \$MONTH = $M, \$DAY = $D;/;
print;
}
}
| Page PathologicallyEclecticRubbishLister |
|
Revision 16 Apr 2004 Parents: Index |