We don't bite newbies here... much | |
PerlMonks |
Re: Nodes count in Linked Listby LanX (Saint) |
on Mar 31, 2015 at 13:16 UTC ( [id://1121985]=note: print w/replies, xml ) | Need Help?? |
MJD shows an implementation of linked lists in Higher Order Perl
which looks quite convincing (though costly) Each node is a two element array [value,tail_ref] with tail_ref being an array ref to the next node or undef. To count length iterate through the list till you get undef. Perl has no built in linked lists b/c arrays cover almost all use cases.
In Section
Seekers of Perl Wisdom
|
|