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