use strict; my $maxcount; my $find; sub read_line { our %hash; my @list = split /[,.?!)"]?\s\)?/, shift; my $count; foreach my $word (@list) { $hash{lc $word}++; $count =$hash{lc $word}; if ($count > $maxcount) { print "$word"; $maxcount++; $find = $word; } } } sub read_file{ my $file=shift; open (FILE, $file) or die "couldn't open $file: $!"; while (my $line = ) { read_line $line; } } read_file @ARGV; my $numwords= keys our %hash; print "distinct words: $numwords\n"; print "frequency of most common word: $maxcount\n"; print "common word: $find";