http://qs321.pair.com?node_id=867595

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

How to eval an array element in regex's substitution ?
Dear All,
I wanna get "Hello zy" in following code. I try to add /e and /ee, all they can't work.
my $s = 'Hello [2][1]'; my @a =('x','y','z'); my $replace ='$a'; $s =~ s/(\[\d{1,2}\])/$replace\1/g; ## only output : Hello $ +a[2]$a[1] print $s;
Pls give me a hand. THX.

Regards

-Pysome