in reply to Text Extraction
Maybe the following. As jdporter did, I have put your sample data in a file named 782426.pl.
The first record in your sample data appears to be incomplete. I have discarded it. Similarly, the last record appears to be an exception and I have discarded that also.
use strict; use warnings; my $file = '782426.pl'; open(my $fh, '<', $file) or die "$file: $!"; my @records = do { local $/ = "\032"; <$fh> }; close($fh); # Discard first and last records shift(@records); pop(@records); foreach (@records) { chop; # remove trailing \032 (record separator) s/^[^\.]*\.+\s*//gm; # Do what you want with the record here print "\n****\n$_\n"; }
update: removed useless substitution (s/^$//gm) from loop.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Text Extraction
by sonicscott9041 (Novice) on Jul 23, 2009 at 01:02 UTC | |
by ig (Vicar) on Jul 23, 2009 at 01:48 UTC | |
by sonicscott9041 (Novice) on Jul 23, 2009 at 02:02 UTC | |
by ig (Vicar) on Jul 23, 2009 at 02:28 UTC | |
by sonicscott9041 (Novice) on Jul 23, 2009 at 02:43 UTC | |
|