2011-04-26 3 views

답변

5

이것은 펄 자주 묻는 질문이다 : How can I open a pipe both to and from a command? (짧은 답변 : IPC::Open2 참조)

또 다른 방법은 외부 프로그램의 출력 캡처 쉘에있는 I/O 리디렉션 기능을 사용하는 것입니다

open my $qsub_proc, '|-', "qsub $command $args > some/file"; 
print {$qsub_proc} $the_input_to_the_command; 
close $qsub_proc; 

open my $qsub_fh, '<', 'some/file'; 
my @qsub_output = <$qsub_fh>; 
... # now parse @qsub_output to get your job id 
관련 문제