in reply to obtaining pid's in Unix environment

Most likely, Perl interpolates the $2 in your awk invocation. I test Perl scripts that call other programs by printing out the command line and comparing that to my expectations:

my $command = "ps -ef | grep $version | grep online| awk '{print $2}'" +; print "Invoking: >>>$command<<<\n"; my $output = `$command`;

Most likely, the output you will see above is not what you want, and you want instead something like:

my $command = sprintf q(ps -ef | grep %s | grep online| awk '{print $2 +}'), $version; print "Invoking: >>>$command<<<\n"; my $output = `$command`;

which circumvents the interpolation of variables. There are many other ways to build up $command without interpolating variables.

Update: Reading JediWizards reply, I realize you're using system - if you want the output of commands, don't use system, use backticks, just like in the shell.