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
In reply to How to eval an array element in regex's substitution by pysome
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |