in reply to Storing pattern matches

Consider using the Alternation metacharacter (|), in the regular expression (perldoc perlre).

You may also need to use "non-capturing parentheses (?:).

        If your eyes hurt after you drink coffee, you have to take the spoon out of the cup.
              -Norm Crosby