my $magicRegex = munge($word); if (/^h$magicRegex$/) {...}