juanbro has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking at some code that essentially says:
Why would one use a coderef here? Why not just say:my $coderef = \&some_subroutine; my ($foo,$bar) = &$coderef('arg1'); my ($biz,$baz) = &$coderef('arg2'); my ($ying,$yang) = &$coderef('arg3'); sub some_subroutine { #...do something with @_... return ($value1, $value2); }
Thanksmy ($foo,$bar) = some_subroutine('arg1');
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: why use a coderef?
by Limbic~Region (Chancellor) on Jun 25, 2007 at 12:57 UTC | |
Re: why use a coderef?
by clinton (Priest) on Jun 25, 2007 at 12:43 UTC | |
Re: why use a coderef?
by exussum0 (Vicar) on Jun 25, 2007 at 13:29 UTC | |
Re: why use a coderef?
by ikegami (Patriarch) on Jun 25, 2007 at 14:29 UTC | |
Re: why use a coderef?
by whereiskurt (Friar) on Jun 25, 2007 at 13:58 UTC | |
Re: why use a coderef?
by FunkyMonk (Chancellor) on Jun 25, 2007 at 22:40 UTC | |
Re: why use a coderef?
by cLive ;-) (Prior) on Jun 25, 2007 at 22:11 UTC | |
Re: why use a coderef?
by ferreira (Chaplain) on Jun 25, 2007 at 20:25 UTC |
Back to
Seekers of Perl Wisdom