Listing 6: Print-appointments.pl
#!/usr/bin/perl -w
use strict;
use diagnostics;
use Appointments;
# Create an instance of Appointments
my $appointments = new Appointments;
# Retrieve today's appointments
my @appointments = $appointments->get_today();
# Iterate through each appointment
foreach my $appointment (@appointments)
{
# Each appointment is a hashref, so print
# its elements
print $appointment->{start_time}, ":\t";
print "\t", $appointment->{first_name},
" ", $appointment->{last_name}, "\n";
print "\t", $appointment->{notes}, "\n";
}