Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Linked list in Perl

by GrandFather (Sage)
on Sep 30, 2012 at 21:45 UTC ( #996546=note: print w/ replies, xml ) Need Help??


in reply to Linked list in Perl

In Perl I create linked lists like:

my @list;

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


Comment on Re: Linked list in Perl
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996546]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-07-29 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (261 votes), past polls