balajinagaraju has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks. I am trying to call a function by passing a scalar variable and a array reference as a argument. The function call is as below.
Here the parameter $command is again a name of a function module which needs to be triggered with the \@paramlist as the argument list for the function pointed by $command. In the function definition of executeCommand i should call the function pointed by the $command with the \@paramlist as the arguments for that function. How do i do that , i am able loop through the parameter list and get the values but how can i trigger the function.Kindly suggest how to proceed. Definition of executeCommand is as below&executeCommand($command, \@paramlist);
sub executeCommand{ print "Inside ExecuteCommand\n"; print "Currently executing Command name:".$_[0]; print "\n"; my $array_reference = $_[1]; foreach my $element (@$array_reference){ print "Parameter:".$element."\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing arguments to functions.
by BrowserUk (Patriarch) on Apr 25, 2012 at 11:26 UTC | |
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 | |
|
Re: Passing arguments to functions.
by Anonymous Monk on Apr 25, 2012 at 11:05 UTC | |
|
Re: Passing arguments to functions.
by Anonymous Monk on Apr 25, 2012 at 11:17 UTC | |
by balajinagaraju (Sexton) on Apr 25, 2012 at 11:29 UTC |