$curr = $head; my $tail; while ($curr) { $tail = { next => $tail, data => $curr->{data}, }; $curr = $curr->{next}; } print Dumper $tail;