Variables between double quotes will be interpolated to their values, but between single quotes they will be taken literally.$aword = 'foo'; # use single quotes instead of double $containmentvar = "$aword"; # use double quotes instead of single
Hope this helps,
Jeff
UPDATE:
Hmm, when I first read your post, I thought you were wanting
symbolic references - I have to agree with tilly on this one,
and do read ar0n's link that he provided,
but here you go anyways:
Remember, you can't use strict with this code, that should be reason enough to find another solution, but if you aren't coding heart monitoring devices you should be ok.$aword = 'foo'; $containmentvar = 'aword'; # no dollar sign here $$containmentvar = 'bar'; # foo or bar? print "$aword\n";
Now that I have handed a loaded gun to somebody, I am going to find a lawyer.
In reply to (jeffa) Re: substitution of variable within a variable
by jeffa
in thread substitution of variable within a variable
by TecoDaN
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |