for $file (@files){ $string = "open (A$file, \"perl part2.pl $file|\")"; eval $string; # Error checking omitted for simplicity }