# Snippet 2a - another stepping stone use strict; use warnings; use Data::Dumper; # Create a normal hash. my %alice = ( home => "555 1234", work => "555 9876", mobile => "555 2580", ); # And another one. my %bob = ( home => "555 2345", work => "555 8765", mobile => "555 1357", ); my %phonebook = (); $phonebook{Alice} = \%alice; # Method 1: Store a direct reference to the %alice hash $phonebook{Bob} = { %bob }; # Method 2: Create an anonymous hash ref, with the contents of %bob $phonebook{Charlie} = { # Method 3: Create and store an anonymous hash ref directly home => "555 3456", work => "555 7654", mobile => "555 2468" }; # Alice's a cool lady. I want to call her at her home number! print "Alice's home number is $phonebook{Alice}->{home}\n"; # She's not there. Maybe she's with Charlie, let's call his cell phone. print "Charlie's mobile number is $phonebook{Charlie}->{mobile}\n\n"; # Gimme all their digits! print Dumper \%phonebook;