in reply to Re: search an array
in thread search an array

I can't seem to get this to work. I thought I'd try this out to compare it for speed with the hash version mentioned later. It never prints the pid in use message even though the pid exists in the array. How do I debug this statement
if ($_ == $xpid) {
To see why the match is not being made ? I tried
print @$_ ;
This gives me the value I expect to see (i.e. a pid) but even though $xpid appears to have the same value the if is not evaluating to true ?

Replies are listed 'Best First'.
Re^3: search an array
by Anonymous Monk on May 26, 2006 at 15:13 UTC
    I've answered my own question. The answer I found is
    if ("@$_" == "$xpid") {
    Sorry for the confusion