There's no reason to go into $&-avoidance mode for this little
one-liner; you can lose the parens. And I don't like to use /'s
as a delimiter when there are so many backslashes in there; makes it
even harder to read.
do shell script "echo " & quoted form of str & " | perl -pe 's,\\w+,\\u\\L$&,g' "
On the command line or in a Perl script, that would just be
s,\w+,\u\L$&,g without the doubled backslashes.
In English: "Substitute (s,) every (,g) sequence of one or more (+)
word characters (\w) by a copy of itself ($&) with all characters
converted to lowercase (\L) and then the first character converted to
uppercase (\u)."