#!perl use strict; use 5.010; local @ARGV = 'myinfo.txt'; local $^I = '.bak'; while( <> ) { s/^Author:.*/Author: Johny5/; s/^Phone:.*\n//; print; }
And since you're already requiring 5.10 (for no reason), you might as well use \K
#!perl use strict; use 5.010; local @ARGV = 'myinfo.txt'; local $^I = '.bak'; while( <> ) { s/^Author: \K.*/Johny5/; s/^Phone:.*\n//; print; }
In reply to Re: "Updating" files.
by ikegami
in thread "Updating" files.
by neutron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |