http://www.perlmonks.org?node_id=413508

hotshot has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I have a string defined as follows:
my $str = 'params.$idx.arg';
$idx will be assigned with integer values in a loop as follows:
for my $idx (0..10) { &do_something($str); }
The thing is that I want $str in the loop to be interpulated with the value of $idx in each loop iteration (the above code will not take there of course), meaning do_something() will get a different parameter each loop iteration ('params.0.arg', 'params.1.arg', etc.).
How can I achive that?

Thanks

Retitled by davido: Corrected spelling of 'interpolation' to improve searchability.