#!/usr/bin/env perl use v5.12; use Data::Dumper; my %students = ( x1 => { name => "Alice", telephone => 1001, regno => "x1", }, x2 => { name => "Bob", telephone => 1002, regno => "x2", }, x3 => { name => "Carol", telephone => 1003, regno => "x3", }, ); say "Let's look at the data structure..."; print Dumper \%students; say "What is student x1's telephone number?"; say $students{x1}{telephone}; say "What is Carol's telephone number?"; my ($carol) = grep { $_->{name} eq "Carol" } values %students; say $carol->{telephone}; say "Now let's delete student x2..."; delete $students{x2}; say "And change Carol's phone number"; $carol->{telephone} = "1004"; say "Let's look at the data structure again..."; print Dumper \%students;