[VPM] passing parameters to sub ref then execute

Peter Scott Peter at PSDT.com
Thu Aug 7 14:26:41 PDT 2008


At 02:21 PM 8/7/2008, Darren Duncan wrote:
>Jer A wrote:
>>if this is how to exec a subroutine ref, without params .eg $o = &$c;
>>how do I pass parameters to it.
>>thanks in advance for your help.
>>Jeremy A
>
>I would spell that like this:
>
>   $o = &{$c}();
>
>And then put the arguments between the parenthesis as usual.

I write

         $o = $c->();

in both cases.  Either there are arguments between the parentheses or 
not.  Preferring the arrow operator for dereferencing is a bestpractice IMHO.


-- 
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/
http://www.perlmedic.com/




More information about the Victoria-pm mailing list