use strict; use warnings; ## examples of sub_function. sub test { print "test\n" } sub test2 {print "test2\n" } sub test3 {print "test3\n" } ## pair up variables with sub_function. my $test = \&test; my $test2 = \&test2; my $test3 = \&test3; my @array = qw/ test test2 test3 /; ## I want to call sub_function each $array. but it is not working.. foreach my $array (@array) { &$$array } ## I want to print test test2 test3 like below examples. ## But below examples is not that good way. please help me :) foreach my $array (@array) { if($array eq "test" ) { $test } if($array eq "test2") { $test2} if($array eq "test3") { $test3} }