in reply to subroutine / dot operator / hash vlaue

Beyond what Anonymonk stated above, this appears to be an XY Problem. Please state what you're trying to achieve here.

ie. in the second example, you're implanting a reference to the function instead of having it evaluate and placing its value. Why?

  • Comment on Re: subroutine / dot operator / hash vlaue

Replies are listed 'Best First'.
Re^2: subroutine / dot operator / hash vlaue [coderef vs. scalarref]
by kcott (Archbishop) on Dec 10, 2015 at 08:25 UTC
    "... a reference to the function ..."

    Sorry for being horribly blunt stevieb, but that's just wrong!

    Reference to the return value of this function (i.e. a scalarref):

    $ perl -wE 'sub f { 42 } say \&f()' SCALAR(0x7f8070805480)

    Reference to a function (i.e. a coderef):

    $ perl -wE 'sub f { 42 } say \&f' CODE(0x7ff5d90314f0)

    Another offering at the altar of "whomsoever personifies Confusion" :-) [reference taken from my reply to OP]

    — Ken