in reply to help with a regexp

I would do it in two steps.

perl -le '$_="xooox"; $_ = ucfirst; s/(.)$/\U$1\E/; print'

Update: Well, maybe one step:

perl -le '$_="xoox"; s/(^.|.$)/\U$1\E/g; print'
-sauoq
"My two cents aren't worth a dime.";