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.
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";
|
---|
In Section
Seekers of Perl Wisdom