For doing stuff with these kinds of substitutions, I always use code like this:
use strict; my %trans = (color => 'red', fruit => 'apple', name => 'chromatic'); my $string = 'Hi, my name is $name. Please hand me a $color $fruit.'; $string =~ s/\$(\w+)/$trans{$1}/eg; print $string;
In reply to RE: Double Interpolation of a String
by davorg
in thread Double Interpolation of a String
by chromatic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |