Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Perl parser gets confused with call to "sort" w/o parens

by vr (Hermit)
on May 16, 2018 at 11:29 UTC ( #1214642=note: print w/replies, xml ) Need Help??


in reply to Re: Perl parser gets confused with call to "sort" w/o parens
in thread Perl parser gets confused with call to "sort" w/o parens

:( Oh, indeed, it's documented, thanks. Yet, CL#1 works OK, and the reason why Perl can be confused here and care is required is neither clear nor explained, in documentation. How CL#4 can be parsed to what's printed out, is unclear. OK, just a thought...

Edit: OK, CL#1 was parsed specially because there was single letter identifier:

>perl -lwe "sub x{@_} print sort x(qw(q w e r t y))" eqrtwy >perl -lwe "sub xx{@_} print sort xx(qw(q w e r t y))" qwerty

Replies are listed 'Best First'.
Re^3: Perl parser gets confused with call to "sort" w/o parens
by BillKSmith (Parson) on May 16, 2018 at 14:53 UTC
    The paragraph that choroba cites, documents four acceptable ways to sort an array returned by a function. I think it is reasonable to assume that anything else is ambiguous and should be considered invalid. In this view, all of your cases are invalid. The fact that some of them appear to do what you intend is irrelevant. It would be helpful if the document explained the reason for this restriction.
    Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1214642]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-11-13 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (149 votes). Check out past polls.

    Notices?