i'm no regular expressions expert, but i can offer a little explanantion.
but, what is the $data =~ tr/A-Z/a-z/; doing?
[tr]anslating any character in the A-Z set of capital letters to its corresponding lowercase character.. or in other words,
tr/target set/replacement set/;
ans in the following...$data =~ s/\b(\w)/\U$1/g;
s = substitute
\b = border so it's looking for a word border
\w = word charachter (like a letter).. since it's in parentheses that means we can refer to this match later in the replacement area..
\U means to uppercase it
$1 refers to the match we found in parentheses, if there were multiple parenteses in our target pattern they would be referred to as $2, $3, etc
then the g; modifier means global, so it searches and replaces every match it can, the i modifier i think has to do with case, not sure about m, but i do know the modifier goes at the end. hope this helps, and there is plenty of info on regular expressions out there to look up though i find it pretty confusing.