in reply to Applying an array to a function
This does the same thing?
#! perl -slw use strict; sub test { my $x = shift; my $y = shift; my $z = shift; print $x + $y + $z; } sub apply2 { my( $code, $argsRef ) = @_; return $code->( @$argsRef ); } apply2( \&test, [1,2,3] );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Applying an array to a function
by eklerks (Novice) on Jun 02, 2010 at 14:02 UTC |