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.
Dear All,
I wanna get "Hello zy" in following code. I try to add /e and /ee, all they can't work.
Pls give me a hand. THX.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;
Regards
-Pysome
Back to
Seekers of Perl Wisdom