"Matt Garrish" <> wrote:
: while (my $str = <>) {
: my $lval = 0;
: foreach my $char ($str =~ /(.)/g) {
: my $ordval = ord($char);
: if ($char =~ /[A-Za-z]/) {
: if ($ordval == ($lval + 1)) {
: print chr($lval) . "$char\n";
: }
: }
: $lval = $ordval;
: }
: }
I'm hip on being cautious around any regex patterns labelled as
"experimental" (re

ther branch of this thread). That technique is
comparatively bulletproof. The \G regex meta can tighten it up without
corrupting the spirit of the algorithm.
while( $str =~ /([[:alpha:]])/g ) {
my $m = $1;
my $n = chr( ord($m)+1 );
print "$m$n\n" if $str =~ /\G$n/;
}