use strict; use warnings; my @testlist=('test1','test2'); foreach (@testlist) { print ("dear user test $_ is currently running\n"); #call test &$_(); } sub test1 { #test1 code print "test1...done\n"; } sub test2 { #test2 code print "test2...done\n"; }