use Regex::PreSuf; my $re = presuf({anychar => 1}, qw(@foo @bar @baz)); print qq($re\n); __RESULT__ \@(?:ba[rz]|foo)