go ahead... be a heretic | |
PerlMonks |
Re: Linked list in Perlby GrandFather (Saint) |
on Sep 30, 2012 at 21:45 UTC ( [id://996546]=note: print w/replies, xml ) | Need Help?? |
In Perl I create linked lists like:
I can then append at the front with unshift or the back with push. I can remove from the front with shift and from the back with pop. I can insert at any index position with splice using splice @list, $iPoint, 0, $item and remove an item anywhere from the list with my ($delItem) = <c>splice @list, $dPoint, 1. Actually I can add multiple items in a single operation using any of push, unshift or splice by using a list instead of a single item and I can use splice to remove multiple contiguous items anywhere from the list. Was there something you want to do with a linked list that isn't included in the box with Perl?
True laziness is hard work
In Section
Seekers of Perl Wisdom
|
|