e****e 发帖数: 179 | 1 【 以下文字转载自 Linux 讨论区 】
发信人: engine (boxing cat), 信区: Linux
标 题: help on replacing text in a file
发信站: BBS 未名空间站 (Wed Oct 31 11:42:35 2007)
I would like to replace string 1 with string 2 in file3.dat, here is what I
did:
#!/usr/bin/perl
@inputfile= ("string1");
@outputfile=("string2");
@attfile=("file3.dat");
$mytempfile=$inputfile[0];
$youtempfile=$outputfile[0];
$hisfile=$attfile[0];
perl -pi -e 's/$mytempfile/$youtempfile/' $hisfile;
The program reports an error:
Scalar found where operator ex |
|