Harry Putnam wrote: > > What is the handy way to record the pid of $some_process in this > fake code? > > $some_process = 'tcpdump -v -ieth0 >file') > system("$some_process") or die "Can't start $some_process: $!";
system() returns false on success and true on failure so "or die ..." will execute when system() succeeds and the $! variable does not contain any useful information, you need $? instead. perldoc -f system > print "Pid is $pid\n"; > > The process is started by a more elaborate perl script at bootup. > and restarted every four hours from syslog. Code above is way simplified. open FILE, '>file' or die "Cannot open file: $!"; my $pid = open DUMP, 'tcpdump -v -ieth0 |' or die "Cannot open pipe from tcpdump: $!"; print FILE while <DUMP>; close DUMP or die "Cannot close pipe from tcpdump: $!"; close FILE; print "Pid was $pid\n"; __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>