my $num = $string =~ s/XX/XX/g; [download]
It works in list context too.
print $string =~ s/XX/XX/g; [download]
In reply to Re^2: count repeatation by ikegami in thread count repeatation by saranperl