Perl に 2 つの関数があるとします。その 2 つの関数の参照の配列を作成します。& コマンドライン引数では、特定の関数を呼び出す配列のインデックスのみを渡します。引数を指定しないと、参照されたすべての関数が配列で呼び出されます (デフォルトの場合)。
それで、これを行うのを手伝ってくれる人はいますか?
## Array content function pointers
my @list= {$Ref0,$Ref1 }
my $fun0Name = “fun0”;
my $Ref0 =&{$fun0Name}();
my $fun1Name = “fun1”;
my $Ref1 =&{$fun1Name}();
#### Two functions
sub fun0() {
print "hi \n";
}
sub fun1() {
print "hello \n";
}
##### Now in cmd argument if i passed Test.pl -t 0(index of array ,means call to 1st function)
##### if i give test.pl -t (No option ) ....then i call both function.