use strict; use warnings; for my $i ( 1 .. 2 ) { $a = 'test'.$i; no strict 'refs'; &$a; } sub test1 { print 'test1'; } sub test2 { print 'test2'; }