use strict; use warnings; my @matches = (); open (DICT, "dictionary.txt") or die "Dictionary.txt: $!\n"; while (my $words = ) { chomp $words; push @matches, $words . " 1" if $words =~ /a$/; push @matches, $words . " 2" if $words =~ /.*[i].*[i].*[i].*[i].*[i].*/gi; push @matches, $words . " 3" if $words =~ /[^aeiou]/gi; my $reverse = reverse($words); push @matches, $words . " 4" if $words eq $reverse; } close (DICT); foreach (@matches) { print $_; }