#!/usr/bin/perl use strict; use warnings; my $line = < 2 and $count_of{$word}++; } print "All words and their counts: \n"; for my $word (sort keys %count_of) { $count_of{$word} > 1 and print "'$word': $count_of{$word}\n"; } __END__