Perl-Sensitive Sunglasses | |
PerlMonks |
Anonymous Data Structures: How Do They Work?by jonjacobmoon (Pilgrim) |
on Jan 14, 2002 at 00:29 UTC ( [id://138457]=perlquestion: print w/replies, xml ) | Need Help?? |
jonjacobmoon has asked for the wisdom of the Perl Monks concerning the following question:
Some time ago, I dabbled in amatuer astronomy. One thing I
learned while looking at an object is sometimes you can see
it better by not looking directly at it. Problem with that
for me was it was hard not to look directly at the object and
if I did view it out of the corner of my eye, I never felt
like I was really seeing it. This is how I have felt recently
about anonymous data structures.
Recently, I had the opportunity to use an anonymous array appropriately in my code. I put it in, it worked, and at the time I did that I understood, or at least I thought I understood, what it was doing and how it worked. But the more I looked at the code and the more I read about anonymous arrays (in this case) the less I understood. In fact, the information I have read so far has been left me wanting more. So, my question is how do these work, internally I mean. I understand that I create the sturcture, it has no name which leaves it without a way to call it directly. This worked in my case because I was iterating over the same array and making it anonymous allowed it to "recreate" itself anew. But HOW does Perl understand this. It is hard to imagine that Perl can access any data structure without some sort of name associated with it. Is it just sort of a "natural reference" with a reference but no name, and if that is the case how does this get handled vis-a-vis the garbage handled alogrithms. I realize this is an esoteric subject, and I am sure my writting skills don't do it justice, but it has plagued me on and off for a week, so I was hoping the wisdom of the monks could pull me through.
I admit it, I am Paco.
Back to
Seekers of Perl Wisdom
|
|