in reply to sorting text into sentences.
use Lingua::EN::Sentence qw(get_sentences); open FH, "SomeFile.txt" or die "can't open: $!\n"; { local $/; my $all=<FH>; } my $sentences=get_sentences($all); ## Get the sentences.
Looking at your code, I don't think split will work like this (spliting an entire array in one). you will need to foreach through @all and split each element individualy or possibly play some fun and games with map.
With the parenthesis round the split pattern you get the punctuation that split acted on stored in your array too.my @all=<>; print "all is:\n"; foreach (@all) { print "$_"; foreach (split /([.,;])/, $_) {print "$_\n"} }
From your later description I think you may want to look at splitting on something like [A..Z]\s*(\.|;) and as you are slurping in the entire file and not making use of the line breaks perhaps you want to try
then split $all into the array of lines Cheers,local $/; my $all=<>;
|
|---|