> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, July 08, 2007 10:49 PM
> To: beginners@perl.org
> Subject: Re: parse help
> 
> 
> >
> > No, the Input Record Separator ($/) can only hold one string.
> > However, your records are actually separated by "\n\n", so 
> setting $/
> > to "\n\n" and then chomp'ing the record will give you
> ..
> No, it does n't work for me. I noticed there are some empty lines  in
> the 'comments' field. Let's say if i parse the record with two newline
> characters, it does not fetch full record if the record contains empty
> lines in the 'comment fileld'.  Do you have any suggestion to avoid
> this situation??
> 
> tx
> karl

Define a state flag in your process loop that turns the parser off and
on. Turn on when it finds "host=", then turn off and save the record
when it finds "env=". That will work only as long as those are always
the first and last lines of every record.

The other option is to only use "host=" to close and open each record.
The first time there is nothing to save, and don't forget to save the
final record when you reach the end of the file.

Bob McConnell

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to