#!/usr/local/bin/perl for(my $i=1; $i<=2; $i++) { $a = 'test'.$i; &$a; } sub test1 { print 'test1'; } sub test2 { print 'test2'; }