我有一个文本文件
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = " "
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# also the default input encoding. Doxygen uses libiconv (or the iconv built
# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
我必须在“
之间输入INPUT行中的路径名我的代码
use strict;
use warnings;
open(FILE, "< abcd") or die $!;
open(FILE1, "> abcd1") or die $!;
my @lines = <FILE>;
my $i = $ARGV[0];
$lines[5] = "";
splice @lines,5,0, 'INPUT = "$i"';
print FILE1 @lines;
close(FILE);
,输出为
INPUT = "$i"
但我希望输出
INPUT = "abcd" #abcd is whatever is passed as arguments
答案 0 :(得分:3)
这应该有效:
splice @lines,5,0, "INPUT = \"$i\"";
答案 1 :(得分:2)
你需要双引号来在字符串中插入$i
变量,所以
splice @lines,5,0, "INPUT = \"$i\"";
或使用qq
的替代引用:
splice @lines,5,0, qq{INPUT = "$i"};