http://qs1969.pair.com?node_id=474792


in reply to How to flatten hashes?

If your hash is all you show us, you can simply say:
my %newhash = ( accesslevels => { func1 => $oldhash{function}{func1}{content}, default => $oldhash{function}{default}{content} } );
But if it is more generic (which I'm guessing it is), a possible approach can be:
my %newhash; foreach my $key1 (keys %oldhash) { foreach my $key2 (keys %{$oldhash{$key1}}) { foreach my $key3 (keys %{$oldhash{$key1}{$key2}}) { $newhash{$key1}{$key3} = $oldhash{$key1}{$key2}{$key3}{con +tent} } } }
HTH

Paul