Perl小程序调不通$outfoutfile.txt$outf~s/(\.\w+$)/.out/unless(open OUT,$outf){die cannot op
Perl小程序调不通
$outf="outfile.txt";
$outf=~s/(\.\w+$)/.out/
unless(open OUT,">$outf"){
die "cannot open $outf\n";
}
while(<>){
s/fred/larry/gi;
print OUT "$_";
}
错误信息
syntax error at 12.pl line 4, near "){"
syntax error at 12.pl line 10,near"}"
Execution of 12.pl aborted due to compilation errors
[解决办法]
第二行后加分号。
