On 08/09/2011 16:58, Marc wrote:
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)) {
                $word = uc($word);
        }
        push @new_words, $word;
}
$string = "@new_words";

print $string . "\n";

Hi Marc

The program below will do what you requested.

Cheers,

Rob


use strict;
use warnings;

my $string = 'The Kcl Group';

$string =~ s/\b([aeiouy]{3,4}|[^aeiouy]{3,4})\b/\U$1/ig;

print $string, "\n";

**OUTPUT**

The KCL Group



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to