in reply to Finding vowels

For the problem as stated, this is a "one line'er". The idea of tr is a good one as others have said. You don't need a foreach loop as grep is designed to filter lists. Here the number of substitutions are used in a scalar context within the grep. No changes are made to the input @array list. But you could just use @array instead of @vowelsGT2 and @array would automatically shrink.
#!/usr/bin/perl -w use strict; my @array = qw( chatterbox teste abode fooooo foo); my @vowelsGT2 = grep{ tr/aeiouAEIOU// >2}@array; print "Words with >2 vowels: @vowelsGT2\n"; __END__ prints: Words with >2 vowels: chatterbox abode fooooo