in reply to Evaluating variables within a string

As it stands, a simple sprintf would work just fine:
my $string = "first_string ref[%u] second_string %s.ref[%u] third_stri +ng"; for (my $i=0; $i<5; $i++) { my $new_string = sprintf $string, $i, "parent_ref", $i; print "$i: $new_string\n"; }
Maybe the real case requires more sophisticated template engine, something like String::Formatter, but from the snippet it doesn't look like that.