in reply to Re: Resolving Imbedded Variables
in thread Resolving Imbedded Variables
Update: A hash is still a better choice because it automatically restricts which variables will be substituted to a set that you specify, which is almost surely desirable.my $string = 'foo: $foo and bar: $bar\n'; print $string, "\n"; my $foo = "foozleberry pie"; my $bar = "barzleberry foo"; $string =~ s/(\$\w+)/$1/gee; print $string, "\n";
|
|---|