On Fri, Sep 05, 2003 at 12:29:31PM -0700, david wrote: > John Fisher wrote: > > > I am trying to figure out how clever it actually is. > > I reversed \L\u with \u\L expecting different results and got the same > > result. Another Company Name Ltd > > > > Why didn't reversing the metacharacters change the results.
Because \L\u doesn't make any sense, so perl does what you (and Jenda) probably meant. If that wasn't what you meant, get rid of the redundant \u. > > $pt=~s/(\w+)/\u\L$1/g > > > > $pt=~s/(\w+)/\L\u$1/g > > > > because \L\u and \u\L is exactly the same: > > [panda]$ perl -MO=Deparse -e 's/(\w+)/\L\u$1/g; s/(\w+)/\u\L$1/g' > s/(\w+)/\u\L$1\E/g; > s/(\w+)/\u\L$1\E/g; > -e syntax OK > [panda]$ Because of this little bit of magic in toke.c: if (strnEQ(s, "L\\u", 3) || strnEQ(s, "U\\l", 3)) tmp = *s, *s = s[2], s[2] = (char)tmp; /* misordered... */ What other language is so helpful? -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]