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:
If you want to use each later in your script, remember to reset the iterator.#!/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";
In Section
Seekers of Perl Wisdom