On Wed, 8 Jun 2005, Dermot Paikkos wrote:

> My question is what would be the best (easiest/fastest) way to parse
> the file. Should I try and set the record separator to something like
>
> $/ = "<record>\n";
>
> Or should I use a XML::Parser (which looks a bit scary) or
> XML::Simple (my first attempt at which failed).

Yes. Use one of the modules, probably XML::Simple. It may take some
learning to get started with, but it will be *much* more robust than
anything you hand-roll using regular expressions.

"Easiest" can be a matter of perspective; plunging in with regexes can
seem easiest to get started with, but it'll be much harder to finish
that way, and much, much harder to maintain if the data format ever
changes -- which they all always do, sooner or later. If you learn how
to use a parsing module and get it to do the work for you, it will be
much simpler to write and maintain in the long run.

If you like, you can show [relevant sections from] your first attempt at
using XML::Simple to the list, and we can help get you through using it.


-- 
Chris Devers

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


Reply via email to