in reply to Re: Reversing string case
in thread Reversing string case

The code i could think of
if ($string =~ /[A-Z]+/){ $string = lc $string; }else{ $string = uc $string; }

Replies are listed 'Best First'.
Re^3: Reversing string case
by moritz (Cardinal) on Aug 25, 2010 at 11:45 UTC
    Your code lower-cases the whole string if a singe uppercase character is found. Is that what you want? What should happen to strings with mixed case?

    Also you ignore all non-ASCII upper case letters.

    Perl 6 - links to (nearly) everything that is Perl 6.