【发布时间】:2013-03-02 01:18:13
【问题描述】:
有没有办法将数据嵌入到 perl 脚本中,然后以类似于 c-shell 的方式将其作为临时文件使用/读取。
cat<< eof>tmp.txt
store a multiline text file
eof
run_some_function on [anotherexternalfile] with [tmp.txt]
rm tmp.txt
我想在一个 perl 脚本中嵌入多组命令/数据文件来封装一组命令,以避免需要过多的外部命令文件。
更新
嵌入的文件/数据需要作为输入文件被读取为另一个可执行函数,如下所示。
system("executable.exe [anotherexternalfile] [tmp.txt]");
【问题讨论】:
-
为什么不使用子程序来存储命令集合
-
和数据变量
-
所以你想知道如何写入tmp.txt?
-
现在你说它听起来很容易。