我有5個文件在不同的目錄中。我從所有文件中提取數據並將其作爲新文件。perl:輸入多個文件作爲數組
注意:將每個文件作爲數組輸入並通過for each循環爲每個文件提取數據。我希望把它作爲一個for循環取文件和處理,其餘
對於文件1我用
foreach (@file)
{
my @temp = split(/\t/, trim($_));
push(@output, $temp[0] . "\t" . $temp[1] . "\n");
}
foreach(uniq(@output))
{
print $OUTPUTFILE $_;
}
我這樣做五次處理五檔。誰能幫我對如何使簡單
cat file1 file2 file3 | do_things_with_perl.pl –
@JohnC,我不想用貓。我需要在數組 – sara
中執行該操作。您可以將該代碼放入循環中。 –