#!/usr/bin/perl use warnings; use strict; chomp(my @words = ); my %count; foreach my $word (@words) { $count{$word} += 1; } foreach my $key (sort keys %count) { print "$key was found $count{$key} times\n"; }