#! /usr/bin/perl use strict; use warnings; my %hash=qw(fruit apple dairy cheese cereal oats); sub whatis{ my $hash=shift; for my $category (keys %{$hash}){ print "$hash->{$category} is a $category\n"; } } whatis(\%hash); #### #! /usr/bin/perl use strict; use warnings; sub foodCategories{ my %hash=qw(fruit apple dairy cheese cereal oats); return \%hash; } sub whatis{ for my $category (keys %{foodCategories()}){ print &foodCategories->{$category}," is a $category\n"; } } whatis();