That won't work if $need_to_interpolate includes a '"'. Fix:
my $string = "cheese"; my $need_to_interpolate = 'smell my "$string"\n'; $need_to_interpolate =~ s/"/\\"/g; print eval(qq{"$need_to_interpolate"});
In reply to Re: Variable Interpolation
by ikegami
in thread Variable Interpolation
by reasonablekeith
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |