in reply to Array to nested hash
use Data::Dumper; use strict; use warnings; my @foo = qw[1 2 3 4 5]; my $bar; for ($_ = $#foo; $_ >= 0; $_--) { $bar = {$foo[$_], $bar}; } print Dumper($bar); [download]