Simple Title case regex
7
RobHarrigan
Function to capitalize the first letter in every word in a string, but only if the entire string is in ALL CAPS.
Example:
"I LIKE TO SCREAM" becomes "I Like To Scream"
"I LIKE to RUN" remains "I LIKE to RUN".
Example:
"I LIKE TO SCREAM" becomes "I Like To Scream"
"I LIKE to RUN" remains "I LIKE to RUN".





my $myString = $_[0];
if ($myString !~ /[a-z]/) {
$myString = lc $myString;
$myString =~ s/(.)/eval uc $1/e;
$myString =~ s/ (\w)/' '.eval uc $1/eg;
}
return $myString;
}