grep selects items from a list based on a test. If the test is true the item is selected, otherwise it is rejected. In your code you are using the contents of $xpid as the "test". You probably actually want something like:
if ( grep {$_ eq $xpid} @procs ) { print "Pid is in use : $xpid\n"; }
In reply to Re: search an array
by GrandFather
in thread search an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |