in reply to setting hash keys by array
Although are you sure this is the trick you want to be performing?use Data::Dumper; my @a = split ' ', q[foo bar baz quux]; my $le = my $h = {}; for(0 .. $#a - 1) { $le->{ $a[$_] } = { $a[$_ + 1] => {} }; $le = $le->{ $a[$_] }; } print Dumper $h; __output__ $VAR1 = { 'foo' => { 'bar' => { 'baz' => { 'quux' => {} } } } };
_________
broquaint
|
---|