#! perl
use strict;
use warnings;
my %families = (Flintstone => [ qw(Pebbles) ],
Simpson => [ qw(Bart Lisa Maggie) ],
Keaton => [ qw(Alex Mallory Jennifer Andy) ]);
for my $name (keys %families)
{
my $num_children = @{ $families{$name} }; # <-- Here's where it
+ happens
if ($num_children == 1)
{
print "There is $num_children child in the $name family\n";
}
else
{
print "There are $num_children children in the $name family\n"
+;
}
}
Hope that helps,
Athanasius <°(((>< contra mundum
|