in reply to Perl linked list

(and another unflagged update, please consider just replying to your initial post ... and please use code tags)

> Here comes the codes I come up with, 

Which is double buggy, test next not value with defined not eq "undef" (data structure here).

Well triple, empty list aren't covered.

Consider a recursive solution.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)

PS: Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Perl linked list
by jdporter (Paladin) on Apr 01, 2015 at 14:05 UTC
    Consider a recursive solution.

    Meh. Consider writing one, maybe, for fun and edification.

    For production code, consider using iterators.