[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [Fun With Perl] What does this do?



On Wed, Jun 16, 1999 at 05:55:14PM +0300, Ariel Scolnicov wrote:
> mjd-list-fwp@plover.com writes:
> 
> > Some time ago I was surprised by this.  See if you can guess what it
> > prints *before* you try it out.
> > 
> >         print "\L\uHELLO, WORLD\E.\n";
> 
> OK, I failed.
> 
> **************** SPOILERS AHEAD ****************
> 
> 
> > If you're not surprised, you're either missing something important or
> > you're a toke.c expert.  (Or you've seen it before.)
> 
> Is it an evaluation order thing?  Or am I _still_ missing something
> important?
> 
> Interestingly (but hopefully not because I'm missing something),
> "\L\UHELLO, WORLD\E.\n" is a syntax error.
> 

And so is this:

% perl -e 'print "\L\u\UHELLO, WORLD\E.\n"'
syntax error at -e line 1, near "\u\L\U"
Execution of -e aborted due to compilation errors.


Apparently perl actually rearranges the characters to put \u and \l before
\U and \L.

I had no idea.


Ronald

==== Want to unsubscribe from this list? (Don't you love us anymore?)
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org