in reply to Passing arguments to functions.
#! perl -slw use strict; { package Other; sub commandFunc { print "Doing Other::commandFunc with args: [ @{ $_[0] } ]"; return; } } sub executeCommand{ no strict 'refs'; my( $func, $argRef ) = @_; *{$func}->( $argRef ); } my @a = 1.. 10; executeCommand( 'Other::commandFunc', \@a ); __END__ C:\test>junk Doing Other::commandFunc with args: [ 1 2 3 4 5 6 7 8 9 10 ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing arguments to functions.
by BillKSmith (Monsignor) on Apr 25, 2012 at 13:36 UTC | |
by BrowserUk (Patriarch) on Apr 25, 2012 at 13:58 UTC | |
by Anonymous Monk on Apr 25, 2012 at 14:00 UTC |