in reply to Reversing string case
The use cases in my case are that the string will either be entirely in upper case of lowercase.
Apologies for not mentioning this earlier.
my $reversed = $str =~ /\p{Lu}/ ? lc $str : uc $str; # Or my ($reversed) = map {/\p{Lu}/ ? lc : uc} $str; [download]