sub deparse { my $tree = shift; my $deparsed = {}; for my $aref (@$tree) { for my $section (@$aref) { my $hash = $deparsed->{$section->[0]} = { }; # $hash is a shortcut for my $aref (@{$section->[1]}) { $hash->{$aref->[0]} = [ $aref->[1] ]; if (my $comment = $aref->[2]) { $comment =~ s/^\s+[;#]//; push @{$hash->{$aref->[0]}}, $comment; } } } } return $deparsed; }