note
ambrus
<p>
You're already showing how to use a zero-width assertion, so why not use that to exclude the apsotrophe?
<c>
$text =~ s{(?!')\p{Punct}}{}g;
</c>
Alternately, how about
<c>
{ no warnings "uninitialized"; $text =~ s{(')|\p{Punct}}{$1}g; }
</c>
<p>
Update: a third solution is to match what you want to keep.
<c>
$text = join "", $text =~ m{[\x27\P{punct}]+}g;
</c>
1036022
1036022