in reply to Re: Variable-width negative lookbehind
in thread Variable-width negative lookbehind

Or, translated into lookbehind notation (and moving the + for more efficiency):
$string =~ s/(?<=[^Y])X+//g;
As long as there's a non-Y character preceding, remove any string of Xs.

The PerlMonk tr/// Advocate