Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Thanks for the replies I don't know how your interpretation of & as the 'address of operator' makes sense in this dereferencing situation. When you dereference a reference you have to indicate what type you produce, and the '&' signifies a subroutine. For instance:
In the first case, $ is used, then @, and finally & is used for the subroutine. The syntax I am trying to understand is: *{"color"} = ....As I understand it, the braces are dereferencing a string, which means perl treats the string as a 'symbolic reference', which in turn causes perl to go to the symbol table and look for "color". Then I think the * must instruct perl to grab the glob slot that corresponds to color--at least that seems to be the way things work when a symbolic reference is on the righthand side:
Sorry if this appears to be a contrived example. It is a simplification of the code on p. 158 in Intermediate Perl that uses typeglobs and symbolic references to dynamically create subroutines. In reply to Re^2: typeglob/symbolic reference question
by 7stud
|
|