http://qs321.pair.com?node_id=555485


in reply to Direct reference to any element in a hash-of-hash

If you don't want to get all those values or keys, you could use each to get just the first pair:
#!/usr/bin/perl use strict; use warnings; my $hoh = { apples => { source => 'uk', colour => 'red', }, pears => { source => 'uk', colour => 'green', }, bananas => { source => 'uk', colour => 'yellow', }, }; my (undef, $v) = each %$hoh; print $v->{'source'}, "\n";
If you want to use each later in your script, remember to reset the iterator.