#! /usr/bin/perl use v5.12; use warnings; ## 2/15/19 my @people = qw{ fred barney fred wlima dino barney fred pebbles }; my %count; # new empty hash $count{$_}++ foreach @people; while ( my ($key, $value) = each %count) { print "$key => $value\n"; } __END__ __OUTPUT__ wlima => 1 barney => 2 dino => 1 fred => 3 pebbles => 1