#! /usr/bin/perl use strict; use warnings; my @array = qw( chatterbox test abode ); my @vowels = qw( a e i o u ); # check each word in @array; so why using $i instead of $word? WORD: for my $word ( @array ) { my $count = 0; # split $word into characters CHARACTER: for my $character ( split //, $word ) { # I see no need for regex if checking each character against each vowel # check if character is equal a vowel $count++ if grep { $_ eq $character } @vowels; # could be inserted to make it (maybe?; depends on the words which are checked) faster #last CHARACTER if $count >= 3; } print "$word has at least 3 or more vowels.\n" if $count >= 3; }