How's this?
#! perl -slw
use strict;
my $test = 'xxx,xyyy,zzz,zzz,ppp,qqq,rrr';
my $re = qr[
(?<!zzz),(?!zzz) # a comma neither preceeded nor followed by the
+token.
|
(?<=zzz),(?!zzz) # or predeeded but not followed
|
(?<!zzz),(?=zzz) # or not preceeded but followed.
]x;
print for split $re, $test;
__END__
P:\test>junk
xxx
xyyy
zzz,zzz
ppp
qqq
rrr
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.