现在已经解决了,之前是在windows下进行的,不知道路径要怎么设置。后来我把cmd调整到程序所在的目录就可以了..
open(readIn, "猜测随机数.pl") or die "Can't read the file: $InFile.\n";
open(writeOut, ">>OutFile.pl") or die "Can't write to the file: $OutFile.\n";
while($line=<readIn>)
{
print( writeOut "$line");
}
close(writeOut);
close(readIn);
我之前的想法就是把任意一个.pl文件(本例中选的是:猜测随机数.pl)复制一下,现在实现了。解决以后觉得这个问题好幼稚,没文化真可怕!