in reply to Re^3: sorting text into sentences.
in thread sorting text into sentences.

Thanks a lot, but i already made a code :
#!/usr/bin/perl -w use Strict; $dat = "a.txt"; open(DAT, "$dat") || die "Can't open the file.\n"; @a=<DAT>; close(DAT); my $temp3; foreach (@a) {chomp $_; $temp3 .= "$_ "} @a = split(/.,;/, $temp3); foreach (@a) {$_ .= "\n";} print @a;
"If you know the right question to ask, you already know the answer."

Replies are listed 'Best First'.
Re^5: sorting text into sentences.
by ysth (Canon) on Sep 06, 2004 at 08:18 UTC
    From your description, you want split(/[.;]/, not /.,;/. And I don't see where capital letters would be checked.
      nevermind, thanks, that'll do :)

      p.s: i remembered that i don't check the dots and dot-apostroph themselves, so split(/.,;/, $watever) will do just fine.

        I strongly suspect you want \. (match a period), not . (match any character). /.,;/ will match (and remove!) any character followed by , followed by ; -- this doesn't sound anything like what you want. Can you provide sample input and desired output?
Re^5: sorting text into sentences.
by ysth (Canon) on Sep 06, 2004 at 09:35 UTC
    By the way, the proper invocation is "use strict;". On case-insensitive file-systems, "use Strict;" will unfortunately not complain, but won't do anything either.