for my $idx (0..10) { my $interp_str; eval "\$interp_str = qq($str)"; do_something($interp_str); }