my $xpid = 1234; %procs = map {$_ => 0} @{$dbh->selectall_arrayref( "select spid from v\$process")}; if (defined($procs{$xpid})) { print "Pid is in use : $xpid\n"; }