You will also need to use the /e modifier (which causes Perl to eval the right-side as an expression).
use strict; my @red; $red[1]='black'; $red[2]='red'; $line =~ s/\$red(\d)/$red[$1]/ge;
In reply to Re: How would I replace the string 'Red1' with $Red[1]?
by Anonymous Monk
in thread How would I replace the string 'Red1' with $Red[1]?
by draco_iii
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |