Answering the first question first, you do indeed have two processes; that's what the | does in the open. See doc:perlopentut.
I'm not sure what want with the second one. If you mean that you want to stop after a specified amount of time, then you could just use alarm() to set a timer for the desired amount of time and exit the loop at that point. Like (untested):
my $done = 0; local $SIG{ALRM} = sub { $done = 1; }; alarm 10; # or whatever while (not $done and $output = <STDIN>) { print $output; # don't need newline as it's there already }
In reply to Re: capture output of tcpdump and PID
by thargas
in thread capture output of tcpdump and PID
by mike928
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |