#!/usr/bin/perl -w use strict; use Benchmark qw':all :hireswallclock'; my %the_hash = ( empl_john_id => 13, empl_john_position => 'slave', empl_bob_id => 0, empl_bob_position => 'manager', client_fred_id => 2, client_fred_phone => 12345, client_goldman_id => 0, client_goldman_phone => 666 ); my %the_hash2 = ( empl => { john => { id => 13, position => 'slave' }, bob => { id => 0, position => 'manager' } }, client => { fred => { id => 2, phone => 12345 }, goldman => { id => 0, phone => 666 } } ); cmpthese(10**6, { 'emulation' => sub {$the_hash{client_goldman_phone}++ }, 'HoH' => sub { $the_hash2{client}{goldman}{phone}++ }, });