下面的代码我试图产生正试图做到这一点:的Perl - 文件内容导入到另一个文件
我试图做的是运行BTEQ脚本从数据库获取数据然后导出到一个平面文件,该平面文件被选中我的Perl脚本(上面的代码),然后这篇文章试图让Perl导入该文件它进入一个fastload文件。这是否更有意义?
while (true) {
#Objective: open dir, get flat-file which was exported from bteq
opendir (DIR, "C:/q2refresh/") or die "Cannot open /my/dir: $!\n"; #open directory with the flat-file
my @Dircontent = readdir DIR;
$filetobecopied = "C:/q2refresh/q2_refresh_prod_export.txt"; #flatfile exported from bteq
$newfile = "C:/q2refresh/Q2_FastLoadFromFlatFile.txt"; #new file flat-file contents will be copied to as "fastload"
copy($filetobecopied, $newfile) or die "File cannot be copied.";
close DIR;
my $items_in_dir = @Dircontent;
if ($items_in_dir > 2) { # > 2 because of "." and ".."
-->>>>>> # take the copied FlatFile above and import into a fastload script located at C:/q2refresh/q2Fastload.txt
}
else {sleep 100;}
}
我需要执行上述粗体部分帮助。如何将C:/q2refresh/Q2_FastLoadFromFlatFile.txt
的内容导入位于C:/q2refresh/q2Fastload.txt
的快速脚本。
//我很抱歉,如果这有些新鲜,但我是Perl新手。
谢谢。
什么“粗体部分”?粗体格式将被代码示例格式覆盖。 – TLP
参见上文 - >>>>>>。 – Jshee
我认为你需要澄清你到底想要做什么。这段代码真的没有解释任何东西。它看起来像你想创建一个永无休止的循环,它不断地复制文件到每个循环覆盖自己。 – TLP