That way it won't work:
$ perl -MProc::ProcessTable -le 'print for @{Proc::ProcessTable->new-> +table}' Proc::ProcessTable::Process=HASH(0x814cb3c) Proc::ProcessTable::Process=HASH(0x827d44c) Proc::ProcessTable::Process=HASH(0x8276e84) Proc::ProcessTable::Process=HASH(0x827d590) Proc::ProcessTable::Process=HASH(0x8276f74) Proc::ProcessTable::Process=HASH(0x8277890) Proc::ProcessTable::Process=HASH(0x8277a40) Proc::ProcessTable::Process=HASH(0x8277bf0) ...
Your match has to become
$_->pid =~ /^$wanted$/
But even then it would be an abuse of grep and of a pattern match, IMHO. Both slightly suboptimal, for
In reply to Re^2: grep or exists
by blazar
in thread grep or exists
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |