Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: How to call a sub-routine ref

by greengaroo (Hermit)
on Oct 19, 2012 at 20:18 UTC ( #1000035=note: print w/ replies, xml ) Need Help??


in reply to Re: How to call a sub-routine ref
in thread How to call a sub-routine ref

And if you don't have an argument to pass, isn't it weird to have empty parenthesis?

$hashref->{'key'}->();

There are no stupid questions, but there are a lot of inquisitive idiots.


Comment on Re^2: How to call a sub-routine ref
Download Code
Re^3: How to call a sub-routine ref
by roboticus (Canon) on Oct 19, 2012 at 20:36 UTC

    greengaroo:

    As a long-time C/C++/C# coder, I don't find the empty parenthesis weird. (Though it took me a (very) little while getting used to leaving off parenthesis altogether.)

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Re^3: How to call a sub-routine ref
by ikegami (Pope) on Oct 19, 2012 at 21:55 UTC
    Why would it be weird? Parens around the arg list, even an empty args list, is the normal way of calling a sub. Omitting parens leads to many problems.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000035]
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: (16)
As of 2014-10-20 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (76 votes), past polls