perl linked list class and cycle finding