Conditional Splitting in Perl
Try splitting on:
/(?<!\.)\s+/
This expression matches any space character that does not follow a period, without matching the period itself.
Without a split using a regex:
my @words = $sent =~ /(\S+\.\s+\S+|\S+)/g;
Try splitting on:
/(?<!\.)\s+/
This expression matches any space character that does not follow a period, without matching the period itself.
Without a split using a regex:
my @words = $sent =~ /(\S+\.\s+\S+|\S+)/g;