use Regexp::List qw( ); my $pids_pat = Regexp::List->new()->list2re(@pids);