perhaps you should take a look at Lingua::EN::Sentence This will handle some common sentence splitting probs like acronyms/abreviations. Something like this may do all you need.
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.

my @all=<>; print "all is:\n"; foreach (@all) { print "$_"; foreach (split /([.,;])/, $_) {print "$_\n"} }
With the parenthesis round the split pattern you get the punctuation that split acted on stored in your array too.

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

local $/; my $all=<>;
then split $all into the array of lines Cheers,
R.

In reply to Re: sorting text into sentences. by Random_Walk
in thread sorting text into sentences. by chiburashka

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.