hotshot has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I have a string defined as follows:
How can I achive that?
Thanks
I have a string defined as follows:
$idx will be assigned with integer values in a loop as follows:my $str = 'params.$idx.arg';
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.).for my $idx (0..10) { &do_something($str); }
How can I achive that?
Thanks
Retitled by davido: Corrected spelling of 'interpolation' to improve searchability.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: String interpolation
by fglock (Vicar) on Dec 09, 2004 at 13:03 UTC | |
Re: String interpolation
by gellyfish (Monsignor) on Dec 09, 2004 at 13:19 UTC | |
Re: String interpolation
by reneeb (Chaplain) on Dec 09, 2004 at 12:56 UTC | |
| |
Re: String interpolation
by edan (Curate) on Dec 09, 2004 at 13:09 UTC | |
Re: String interpolation
by kelan (Deacon) on Dec 09, 2004 at 13:24 UTC | |
Re: String interpolation
by kappa (Chaplain) on Dec 09, 2004 at 15:19 UTC | |
Re: String interpolation
by hotshot (Prior) on Dec 09, 2004 at 15:02 UTC |
Back to
Seekers of Perl Wisdom