http://www.perlmonks.org?node_id=1000017


in reply to How to call a sub-routine ref

Is the first one even correct? I get the Useless use of private variable in void context warning, when warnings are enabled.

Or, did you mean to say:

&$ref();

I prefer the second one, as it feels more consistent with the way the other references are used as well:

$aref->[...]; # as opposed to @$ref[...] $href->{...}; # as opposed to %$ref{...}

Replies are listed 'Best First'.
Re^2: How to call a sub-routine ref
by greengaroo (Hermit) on Oct 19, 2012 at 20:08 UTC

    You are right, I forgot the "&". Fixed.

    And I agree with what you are saying.

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