0
我用Perl分叉進程,實際上它是一個wget命令。 Wget將一些數據寫入文件。我想捕獲wget生成的輸出(不是文件),並將它帶到主程序中。這是我正在處理的代碼片段:用Perl分叉進程輸出
my $pid;
my @wgetDump;
my $videoFileName = "abc";
my $fileURL = "http://www.youtube.com/watch?v=Y8NI2qUZ1co&feature=relmfu";
if ($pid = fork) {
####Parent Process
print "Child Process ID: $pid";
} else {
####child process
@wgetDump = `wget -O $videoFileName -c \"$fileURL\" 2>&1`;
}
foreach (@wgetDump) {
### Here it want to get the @wgetDump Data which is actually the output of child process.
### But I am not getting anything here.
}
任何人都可以請建議。