I was perusing perlfaq4
during my lunch break today and came across the topic "How do I handle linked lists?" The first sentence of the answer reads in part as follows: "In general, you usually don't need a linked list in Perl..." I did a double take and a silent "Hoo-aahh!" I have rather nasty memories of trying to follow material on linked lists in certain algorithm texts years ago, so realizing that a programming language (i.e. Perl) can be widely accepted without linked lists as a feature was gratifying and enlightening.
Another quote from the faq: "If you really, really wanted, you could use structures as described in perldsc
and do just what the algorithm book tells you to do...but again, Perl's built-in are virtually always good enough." To me, this is another feature that pushes Perl to the top of my list when considering languages to use for coding projects.
Have any monks implemented linked-list structures in their Perl code, and if so did your performance improvements outweigh the additional complexity of the code?
Update: The node Shift, Pop, Unshift and Push with Impunity!
showed up in the
Selected Best Nodes
and based on my reading of it makes me comfortable that Perl is very efficient at taking care of the kind of work that linked-list code might otherwise be needed to do such as demerphq
describes in his reply
in this thread.