in reply to Getting another process's pid

If it's supported by your system you could always use Proc::ProcessTable e.g
my $pt = Proc::ProcessTable->new; print "Found $progname running under $_->{pid}\n" for grep { $_->{pid} != $$ && $_->{cmndline} =~ /$progname/ } @{ $pt->table };
HTH

_________
broquaint