I once wrote linked-list and cons-cell classes in Perl, but I can't seem to find them anymore. Anyway, IIRC, I used a listref to hold the cons cells themselves and a recursive linked-list constructor (based on the classic (Lisp) definition of a (linked) list as either the empty list (undef) or the cons of a (scalar) value and a (possibly empty) list).