in reply to search an array
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"; }
|
|---|