Using Perl to model a singly linked list