http://www.perlmonks.org?node_id=993214


in reply to Re^2: Extracting values from nested hashrefs
in thread Extracting values from nested hashrefs

Why be more cryptic that you need to be?
Doing so will not be more efficient.
#!/usr/bin/perl -w use strict; my $animals = { gnu => { humps => 0, mascot_for => 'emacs', }, dromedary => { humps => 1, mascot_for => 'perl', }, camel => { humps => 2, mascot_for => 'perl', }, }; foreach my $critter (keys %$animals) { print "$critter "; #camel gnu dromedary } print "\n"; foreach my $critter (keys %$animals) #sort if you want to { print "$animals->{$critter}{humps} "; #2 0 1 } print "\n";