in reply to substitution preserving capitilization

The key is to capture the term that you actually matched, and use that in the substitution.
Something like this:
$term = 'cat'; $text =~ s/\b($term)\b/<a href=x>$1</a>/i;
(Note: you don't need to capture the stuff before and after the term, just to put them back in the replacement. That's what happens by default.)

By taking this approach, you can make $term be a conjunction of all the possibilities, like so:
$term = join '|', 'cat', 'Cat', 'dog', 'Dog';
Then, whichever one matches, that will be seen in $1 in the replacement string.

jdporter
...porque es dificil estar guapo y blanco.