in reply to Re: I'm surprized with \L, \l, \U and \u, are you too? :-)
in thread I'm surprized with \L, \l, \U and \u, are you too? :-)

So it acts like list ops, with special rules to do the right thing when there are adjacent escapes.

Um, I'm not sure what you mean by that, the behavior appears inconsistent

use Test::More qw' tests 2 '; is( "\LA\uA", "??", '\LA\uA' ); is( "\L\uAA", "??", '\L\uAA' ); __END__ 1..2 not ok 1 - \LA\uA # Failed test '\LA\uA' # at crap line 2. # got: 'aa' # expected: '??' not ok 2 - \L\uAA # Failed test '\L\uAA' # at crap line 3. # got: 'Aa' # expected: '??' # Looks like you failed 2 tests of 2.
The way I read perlop they should both result in aa. Or to be a consistent special case, both should result with one character uppercased.

Replies are listed 'Best First'.
Re^3: I'm surprized with \L, \l, \U and \u, are you too? :-)
by ikegami (Patriarch) on Feb 21, 2011 at 10:19 UTC
    \L\u makes no sense (would be the same as just \L), so Perl treats it as \u\L (which was surely the intended effect).
      \L\u makes no sense (would be the same as just \L)

      $foo + 1 - 1 might not make sense either, but that is completely irrelevant, it should work as advertised

      so Perl treats it as \u\L (which was surely the intended effect).

      How would you know if it was the intended effect? If there were such a bizzare exception, surely it would be documented.

        it should work as advertised

        It does since conflict resolution is not advertised to my knowledge.

        How would you know if it was the intended effect?

        It's called anticipation of common pitfall in language design.

        If there were such a bizzare exception

        It applies the rightmost applicable "one" modifier if any. Otherwise, it applies the rightmost applicable "all" modifier if any.

        What part of that is "a bizarre exception"? (Upd: The answer is that this isn't what's happening. Counter example "\Lfoo\ubar". )

Re^3: I'm surprized with \L, \l, \U and \u, are you too? :-)
by Anonymous Monk on Feb 21, 2011 at 09:54 UTC
    To clarify , if as perlop states
    "\Q\t\E" is converted to quotemeta("\t"),
    shouldn't both
    "\LA\uA" be converted to lc( "A\uA" ) "\L\uAA" be converted to lc( "\uAA" )