in reply to case preservation in regexp

This will probably do what you are asking for:

$text =~ s[\b([Cc]at)\b][<span class="topic">$1</a>]g;

but you also probably want </span> rather than </a> as requested :)


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.