in reply to Re: hash key regular expression pattern
in thread hash key regular expression pattern

Two suggestions:

  1. Precompile the regexs
    qr/C[AEIOU]NWAY/ => 'AAA' ...
  2. Consider storing the regexes in an array, and keeping a separate lookup hash for the values ( or using a Tied hash whose key order you can control ). This will let you put the most common cases first, assuming you exit the loop on the first match, and that you are optimizing for speed.