in reply to Evaluating variables within a string
Maybe the real case requires more sophisticated template engine, something like String::Formatter, but from the snippet it doesn't look like that.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"; }
|
|---|