in reply to From: array To: complex hash

I'll take the opportunity to plug reduce again:
use List::Util qw(reduce); use Data::Dumper; my @c = (1, 2, 3, 4); my %d; reduce { $a->{$b} ||= {} } \%d, @c; print Dumper \%d;
yields:
$VAR1 = { '1' => { '2' => { '3' => { '4' => {} } } } };
If the value of the terminating key needs to be something else than {}:
(reduce { $a->{$b} ||= {} } \%d, @c[0..$#c-1])->{$c[$#c]} = 42; print Dumper \%d;
which is slightly uglier, but will yield:
$VAR1 = { '1' => { '2' => { '3' => { '4' => 42 } } } };