in reply to Reversing string case

What did you try so far? At which point did you fail? Have you looked at the functions uc and lc?

HTH, Rata

Replies are listed 'Best First'.
Re^2: Reversing string case
by perlpal (Scribe) on Aug 25, 2010 at 11:41 UTC
    The code i could think of
    if ($string =~ /[A-Z]+/){ $string = lc $string; }else{ $string = uc $string; }
      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.