Hi Marc, Please check >>> <<<< comment in your code below: use strict; use warnings;
my $string = 'The Kcl Group'; my @words = split(/ /, $string); my @new_words; foreach my $word (@words) { >>> if ((length $word >= 3 and length $word <= 4) and ($word !~ m/[aeiouy]+/gi or $word !~ m/[bcdfghjklmnpqrstvwxz]+/gi)) { <<<<<< ====> remove the "g" from /gi <<<< =====you will get what you want! $word = uc($word); } push @new_words, $word; } $string = "@new_words"; print $string . "\n";