Parsing English is hard ;-> but if you're fairly confident of the 
formatting, you can try and add in a marker and then split on that:
   $msg =~ s/((?:JAN|FEB|...|OCT|NOV|DEC)\s\d+\s\-)/|#|$1/g;
   @ans = grep { /\w/ } split('\|#\|', $msg);


The elipsis there is the rest of the months (note, they *must* be upper 
case though you can mark that adding the "i" modifier to the subst (and, 
in the 'non-capturing parens' by adding between the ? and the : "(?i:JAN 
...") and the grep is to ditch in the empty first match.

a

my $msg =-
'OCT 1 - this is line one
NOV 1 - this is line 2
NOV 2 - this is line III';
my @ans = split(/\n/, $msg);

foreach my $line ( @ans ) {
   print "line: $line\n";
   }

   $msg =~ s/\n/ /g;
   print "Msg: $msg\n";
   $msg =~ s/((?:JAN|FEB|OCT|NOV|DEC)\s\d+\s\-)/|#|$1/g;
   print "Msg: $msg\n";
   @ans = grep { /\w/ } split('\|#\|', $msg);

foreach my $line ( @ans ) {
   print "line2: $line\n";
   }

----------------------
Andy Bach
Systems Mangler
Internet: andy_b...@wiwb.uscourts.gov
Voice: (608) 261-5738, Cell: (608) 658-1890

We are what we pretend to be, so we must be careful about what we 
pretend to be.
Kurt Vonnegut
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to