develooper Front page | perl.perl5.porters | Postings from February 2011

Re: [perl #84578] Bug report: error with \L, \l, \U and \uoperators

Thread Previous
February 22, 2011 02:31
Re: [perl #84578] Bug report: error with \L, \l, \U and \uoperators
Message ID:
On Mon, Feb 21, 2011 at 06:57:58AM -0800, Serge wrote:
> # New Ticket Created by  Serge 
> # Please include the string:  [perl #84578]
> # in the subject line of all future correspondence about this issue. 
> # <URL: >
> Hello Perl maintainers,
>  does the operators \L, \l, \U, and \u have right to left associativity,
> or vice versa? I think, the operators must have right to left associativity as =.
> Have the operators such property as a priority?

All that's being said about priorities in "Gory details of parsing quoted
constructs" in perlop is:

  All operations above are performed simultaneously, left to right.

Which is vague enough that any behaviour described below can be explained
away as "not a bug". ;-)

> print "\u\LdD\n";   # Dd    It seems, first works \L, then \u. Right.
> print "\u\la\n";    # A     First \l, then \u. Right
> print "\l\ua\n";    # a     First \u, then \l. Right
> print "\L\udD\n";   # Dd    It seems, first works \L, then \u. I think, it's a bug!

I tend to agree. I'd expect it to be equivalent to

    lc ucfirst "dD";

But there's the "left to right" statement. Whatever that means.

> print lc "\udD\n";  # dd    Yes, the result differ from previous line!
> print "\LdD\udD\n"; # dddd  It seems, first works \u, then \L, hm...

That appears to be inconsistent with "\L\udD\n";

> print "\L\Ua\n";    # Syntax error, oops!
> print "\U\La\n";    # Syntax error
> print "\L\La\n";    # Syntax error

That's just plain weird, IMO.

> print "\u\la\n";    # A     Right
> print "\u\ua\n";    # A     Right


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About