while (<>) { chomp; my @values = (m/ (.) # One character (?!\1) # not followed by that character (?=.) # but followed by a character /gx); print join(",", @values), "\n"; }
This uses zero length lookaheads to test first that the same character does not follow, and then also that at least one character follows.
Update: Removed needless $_ =~.
It is said that "only perl can parse Perl." I don't even come close until my 3rd cup of coffee. --MidLifeXis
In reply to Re: Anything else is fine!
by MidLifeXis
in thread Anything else is fine!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |