c:\@Work\Perl\monks>perl -wMstrict -le "my $consonants = qr{ [^aeiouAEIOU]+ }xms; ;; my $s = qq{four score\nand seven\nyears ago\nour fathers\n}; print qq{>$s<}; ;; my $offset = 0; my $pos; while (0 <= ($pos = index $s, qq{\n}, $offset)) { substr($s, $offset, $pos) =~ s{ ($consonants) }{\U$1}xmsg; $offset = ++$pos; } print qq{>$s<}; " >four score and seven years ago our fathers < >FouR SCoRe aND SeVeN YeaRS aGo ouR FaTHeRS < #### c:\@Work\Perl\monks>perl -wMstrict -le "my $consonants = qr{ [^aeiouAEIOU]+ }xms; ;; my $s = qq{four score\nand seven\nyears ago\nour fathers\n}; print qq{>$s<}; ;; my $offset = 0; my $pos; while (0 <= ($pos = index $s, qq{\n}, $offset)) { printf qq{==%s== \n}, substr($s, $offset, $pos-$offset); substr($s, $offset, $pos-$offset) =~ s{ ($consonants) }{\U$1}xmsg; $offset = ++$pos; } print qq{>$s<}; " >four score and seven years ago our fathers < ==four score== ==and seven== ==years ago== ==our fathers== >FouR SCoRe aND SeVeN YeaRS aGo ouR FaTHeRS < #### c:\@Work\Perl\monks>perl -wMstrict -le "my $consonants = qr{ [^aeiouAEIOU]+ }xms; ;; my $s = qq{four score\nand seven\nyears ago\nour fathers\n}; print qq{>$s<}; ;; my $offset = 0; my $pos; while (0 <= ($pos = index $s, qq{\n}, $offset)) { process(substr $s, $offset, $pos-$offset); $offset = ++$pos; } print qq{>$s<}; ;; sub process { printf qq{==%s== \n}, $_[0]; $_[0] =~ s{ ($consonants) }{\U$1}xmsg; } " >four score and seven years ago our fathers < ==four score== ==and seven== ==years ago== ==our fathers== >FouR SCoRe aND SeVeN YeaRS aGo ouR FaTHeRS <