Steve Hemond wrote: > > I think I begin to understand... > > I begin by fetching the results of the ps -efA command and split it > into many variables ($uid, $pid, etc.) > > open(PS, "ps -efA|");
You should _ALWAYS_ verify that the file opened correctly! > while (<PS>) { > ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split; Ah yes, more fun with split. :-) Your line above is interpreted by perl as: ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split ' ', $_, 9; Where the ninth field is discarded. You want to tell split that you want exactly eight fields. ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split ' ', $_, 8; You are also going to have to use chomp because $cmd will have a trailing newline. chomp; ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split ' ', $_, 8; > if ($cmd =~ /dispatch genie/) { > $infos{$pid}{'uid'} = $uid; > $infos{$pid}{'ppid'} = $ppid; > $infos{$pid}{'c'} = $c; > $infos{$pid}{'stime'} = $stime; > $infos{$pid}{'tty'} = $tty; > $infos{$pid}{'time'} = $time; > $infos{$pid}{'cmd'} = $cmd; open PS, 'ps -efA |' or die "Cannot open pipe from ps: $!"; while ( <PS> ) { next unless /dispatch genie/; chomp; my ( $uid, $pid, $ppid, $c, $stime, $tty, $time, $cmd ) = split ' ', $_, 8; @{ $infos{ $pid } }{ qw/ uid ppid c stime tty time cmd / } = ( $uid, $ppid, $c, $stime, $tty, $time, $cmd ); } close PS or die "Cannot close pipe from ps: $!"; 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>