Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: When is a function call not a function call

by dpuu (Chaplain)
on Mar 30, 2006 at 04:52 UTC ( #540116=note: print w/ replies, xml ) Need Help??


in reply to Re: When is a function call not a function call
in thread When is a function call not a function call

That doesn't seem to work:

% perl -we 'sub fn {print "$a$b\n"} print(sort(fn(0,0,1,2)))' Unquoted string "fn" may clash with future reserved word at -e line 1. 00 10 21 0012
I can eliminate the warnings by choosing a function name that isn't all-lowercase but, as the output demonstrates, the function is still called as a comparator, not a modifier of the input list.

Update: I was using perl 5.6.1. The parentheses trick works with 5.8.

--Dave
Opinions my own; statements of fact may be in error.


Comment on Re^2: When is a function call not a function call
Download Code
Replies are listed 'Best First'.
Re^3: When is a function call not a function call
by duff (Vicar) on Mar 30, 2006 at 05:55 UTC

    It's good to know that 5.6.x is broken in this regard in case one of us is unlucky enough to be required to use a 5 year old perl distribution. :-)

    thanks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2015-07-07 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls