in reply to Re: Reversing string case
in thread 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.

Replies are listed 'Best First'.
Re^3: Reversing string case
by JavaFan (Canon) on Aug 25, 2010 at 14:07 UTC
    In that case:
    my $reversed = $str =~ /\p{Lu}/ ? lc $str : uc $str; # Or my ($reversed) = map {/\p{Lu}/ ? lc : uc} $str;