my $string = "XXXX"; my @count = split( "XX", $string ); print $#count; # Prints -1