in reply to obtaining pid's in Unix environment

Here's more of a perlish way to get what you want, which is what you seemed to be asking for:
open(PS, "ps -ef |") or die "Problem invoking 'ps': $!\n"; while (<PS>) { next unless /$version/ && /online/; my($pid) = (split)[2]; print "pid $pid\n"; } close(PS);

Cheers,
Matt

P.S. If you want to access the value of $pid outside of the while loop, drop the 'my' but keep the parens, but that will break if there's more than one match:

while (<PS>) { next unless /$version/ && /online/; ($pid) = (split)[2]; } print "pid $pid\n";