There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
IMO the term "an anonymous X" is a term that is a bit of a distraction as it is often used as a synonym for "a reference to an X". Most times the fact that a given ref is truely anonymous is completely irrelevent to anything. In fact the only case I can think where the term means anything useful is referring to distinct notational styles of creation/declaration of the vars involved. Furthermore the fact that a given ref may be anonymous at one time does not mean that it will always be anonymous, and likewise the fact that a given ref is named at one does not mean that later on it wont be anonymous. Consider some of the examples below:
Conclusion: the term anonymous really is only a useful distinction when considering creation/declaration notation:
Outside of that there is no reason to use the expression as there are functionally no differences between a "reference to an array" and a "anonymous array". The latter can only be manipulated as the former. I supect the main reason people tend to use this term is brevity: if you need to describe the args to a subroutine and you want to say "reference to an array" then "anonymous array" can be an attractive alternative. Albeit a somewhat confusing one to someone who isn't aware there that really is no way for a peice of code to know if a given reference is to an anonymous or named array. This is especially true as that status may be determined at run time via dynamic scoping.
--- demerphq In reply to Re: Introduction to anonymous arrays and hashes
by demerphq
|
|