in reply to ucfirst(uclast(lc($user))) ?

Define "works".
my $user = "Hello There, Trusting Programmer"; $user =~ s/^(.)(.*)(.)$/\u$1\L$2\E\u$3/; print $user;
At the least you need a /s modifier...