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