Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Re: Re: my sub ?

by maverick (Curate)
on Mar 25, 2002 at 20:06 UTC ( #154198=note: print w/ replies, xml ) Need Help??

in reply to Re: Re: my sub ?
in thread my sub ?

Yes it does, but if you just stick $ref; out there by itself, or with () after it, perl doesn't get that that's supposed to be a function call and throws a syntax error.

You pretty much have to have the & as far as I know.

Or you could use $ref->(); It's monday and I'm being a blonde.

Update:Thanks chromatic, Fletch, and shotgunefx for the clue-by-four-ing.

perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"

Comment on Re: Re: Re: my sub ?
Replies are listed 'Best First'.
Re: Re: Re: Re: my sub ?
by Fletch (Chancellor) on Mar 25, 2002 at 20:09 UTC

    $ref->() works just fine. As would &{$ref}().

Re(4): my sub ?
by shotgunefx (Parson) on Mar 25, 2002 at 20:12 UTC
    Unless I want the behavior, I usually call a code ref with
    Probably 9 out of 10 times you can get away with it but it can product subtle bugs. I wasn't originally aware of the implied passing of @_ and it was never a problem.. until.


    "To be civilized is to deny one's nature."

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2015-11-25 21:39 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (691 votes), past polls