my @wanted_re = ( qr/^AB/, qr/^CD/, ); sub want_global { my $g = shift; for my $re (@wanted_re) { return 1 if $g =~ /$re/; } return; }