in reply to Capitalization and Regex

Indirect answer to your question: don't do this. You don't need to make a sub to translate a name into something that you can put in a regexp. Just put it in the regexp with \Q and \E (see quotemeta in perfunc docs). Also, as several folks stated, use the /i modifier on your regexp.

So... do not try to do:

my $munged_name = Regch($name); $thing =~ /$munged_name/;
Rather... try this:
$thing =~ /\Q$name\E/i;

How much easier is that? Also, you learned an important thing about perl. :-D

-----------------------------------

However, if you want a direct and exact answer to your question, you could do this:

sub Regch { return "(?i:\Q$_[0]\E)"; }
Read the docs on perlre to learn more about why.

------------
:Wq
Not an editor command: Wq