## (reduce #(hash-map %2 %1) 1 (reverse [:foo :bar :baz :quux])) use List::Util qw( reduce ); use Data::Dumper qw( Dumper ); my $hash = reduce { +{ $b => $a } } 1, reverse( qw( foo bar baz quux ) ); say Dumper( $hash ); __END__ $VAR1 = { 'foo' => { 'bar' => { 'baz' => { 'quux' => '1' } } } };