in reply to Array to nested hash
Do it backwards.
use strict; use warnings; use Data::Dumper; my @foo = qw/1 2 3 4 5 6/; my $href; foreach my $key ( reverse @foo ) { $href = { $key, $href }; } print Dumper $href;
This also turns out to be very similar to one of the easiest ways in Perl to build a traditional ( in the tradition of computer science ) linked list.
Dave
|
|---|