下面的代碼我試圖產生正試圖做到這一點:的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