Can this indeed be done?
Yes, it can be done, using symbolic references. But, symbolic references (using a string to determine the variable name of a global) is considered very bad and very unmaintainable. You are right about using hashes: they're a lot better than having variable variable names.
$object->$name_of_method() is perfectly valid, but the syntax for the symbolic reference would be ${ $_ } or $$_ (I'd even use ${ "$_" } to make sure no-one will think $_ holds a real reference). Please don't use symbolic references (fortunately, strict doesn't allow you to) and use a hash instead.
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
In reply to Re: Variable variable?
by Juerd
in thread Variable variable?
by Ryszard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |