my $module = 'xyz abc'; my @ppids = map {(split)[2]} grep /$module/,`ps -ef`; print "@ppids\n";