in reply to Getting another process's pid

If something works for you, it's very Perlish to incorporate that in your Perl program. Perl is, after all, a very succesfull glue language.
my $pid = `ps ax | awk '/programname/ && !/awk/ {print \$1}`; # ;-)
Or you could do:
open my $ps => "ps ax |" or die; my $pid; while (<$ps>) { if (/^\s*(\d+).*\bprogramname\b/) { $pid = $1; last; } } close $ps or die;

If you happen to run Solaris, you could make use of psgrep instead of ps.

Abigail