in reply to How can I keep or discard certain blocks of an XML file based on first line of block?

tl;dr

perlintro#Files and I/O

perlintro#Parentheses for capturing and perlrequick#Extracting matches

DateTime, DateTime::Format::Strptime more portable than Time::Piece strptime

Re: parsing xml, xpather.pl/htmltreexpather.pl

  • Comment on Re: How can I keep or discard certain blocks of an XML file based on first line of block?

Replies are listed 'Best First'.
Re: How can I keep or discard certain blocks of an XML file based on first line of block?
by 1s44c (Scribe) on Jun 26, 2014 at 07:46 UTC
    BASIC on a TRS-80 :) Nice.
    It doesn't sound too hard to convert the input to a scalar with join and do a non-greedy pattern match to cut out the parts you don't want. Hacking XML in this way always seems to end up causing more pain than it's worth. You are better off using a XML module from CPAN that has been tested and will cover every corner case. Even if learning how to use that module takes longer it's an investment in the speed of your future coding and the stability of your code.