[Pdx-pm] Not what I expected

Michael G Schwern schwern at gmail.com
Wed Nov 1 12:23:34 PST 2006

paull at peak.org wrote:
> Ok, the parser seeing it as "sort block list", explains the observed
> behavior of not sorting and not uniquifying.  Now explain why it is allowed
> to arrive at the "sort block list" conclusion.  The parenthesization of
> uniq's arguments should preclude that interpretation.
> My read of perlop says functions with parenthesized arguments are at the
> top of the precedence table.  sort should not be able to take this
>    sort uniq( @list )
> and turn it into
>    sort \&uniq @list

Here's my guess.  The defining thing is the parents around sort's arguments.  With the parens it cannot be "sort BLOCK LIST" or "sort SUBNAME LIST" because those cannot have parens.  It has to be "sort LIST".  Without the parens I can only guess you're hitting some sort of bug in the parser about resolving the sort syntax ambiguity.

Its worth perlbugging.  You have a nice succinct test case.

More information about the Pdx-pm-list mailing list