use Data::Dumper; my $aoa = []; for my $key ( keys %$start ) { push @$aoa , [ $key , keys %{ $start->{$key} } ]; } print Dumper($aoa);