in reply to Help to slurp records - $/ maybe?
You could use the following (coarse, not fully tested, yada yada yada) approach:
Which outputs:#!/usr/bin/perl -w use strict; use warnings; my $data; { local $/ = undef; $data = <DATA>; } print "Record: [$1]\n" while ( $data =~ /(Field 1:.*?Field 3:[^\n]+)/sg ); __DATA__ Field 1: abc Field 2: asdasdasdf Field 2: asdsaads Field 2: asdf Field 3: asfssadfsad Field 1: abc Field 2: asdf Field 3: asfssadfsad Field 1: abc
Record: [Field 1: abc Field 2: asdasdasdf Field 2: asdsaads Field 2: asdf Field 3: asfssadfsad] Record: [Field 1: abc Field 2: asdf Field 3: asfssadfsad] Record: [Field 1: abc Field 2: asdasdasdf2 Field 2: asdf3 Field 3: asfssadfsad]
HTH,
-- JaWi
"A chicken is an egg's way of producing more eggs."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Help to slurp records - $/ maybe?
by Limbic~Region (Chancellor) on May 02, 2003 at 13:55 UTC | |
by JaWi (Hermit) on May 02, 2003 at 14:35 UTC |
In Section
Seekers of Perl Wisdom