我需要替换以下字符串:
<book name=""
author="">
至
<magazine>
我下面的代码不起作用:
sub substitution
{
my $find = "book name\=\"\"\nauthor\=\"\"";
my $replace = "magazine";
{
local @ARGV = ("$_[0]");
local $^I = '.bac';
while( <> )
{
if( s/$find/$replace/ig ) {
print;
}
else {
print;
}
} //while
}