On Wed, 11 Dec 2002 18:38:31 -0500, [EMAIL PROTECTED] (B-E-G Gomes) wrote: > >Looking for a simple method of getting a single process ID (for a >process such as syslogd) and store it in a scalar. > >I've found a few methods of doing so but they haven't been pretty. > >I'm taking suggestions :) ################################################## #!/usr/bin/perl -w use strict; use Proc::ProcessTable;
my $t1 = new Proc::ProcessTable; my $pid; my $commandline = shift || $0; foreach my $p (@{$t1->table}){ if($p->cmndline =~ /\Q$commandline\E/){ $pid = $p->pid; print "$pid\n"; } } ################################################### -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]