in reply to Re: for loop trouble
in thread for loop trouble

There also is a module which implements the part function...

see: List::Part

use List::Part; my ( $in, $out ) = part { m/$hit/ } @pids;

Where $in is an arrayref to the matches, and $out to the rest.