in reply to Re^2: printing complex data structures (values)
in thread printing complex data structures

In this case it's IMHO better to use a hash-slice @hash{LIST}

... it'll give me full control over the order since I can include any LIST not just sorted keys.

But still basically operating on values...

sub base_code { my ($h_codes) = @_; for my $h_planet ( @$h_codes{ sort keys %$h_codes }) { for my $a_aa ( @$h_planet{ sort keys %$h_planet}) { for my $codon ( @$a_aa ) { print $codon, "\n"; } } } }

or for convenience

sub sorted_values { my $h_ref =shift; return @$h_ref{ sort keys %$h_ref } } sub base_code2 { my ($h_codes) = @_; for my $h_planet ( sorted_values $h_codes ) { for my $a_aa ( sorted_values $h_planet ) { for my $codon ( @$a_aa ) { print $codon, "\n"; } } } }

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!