use strict; use warnings; my @userWords = qw(kicking kick); my %words = map {chomp; lc $_ => 0} split ' ', ; exists $words{lc $_} && $words{$_} >= 0 ? ++$words{$_} : --$words{$_} for @userWords; for (sort keys %words) { next if ! $words{$_}; print "not " if $words{$_} < 0; print "found $_\n"; } __DATA__ George Best is Alive and Kicking