in reply to parsing XMLish data

I like asiufy's idea and I'll definatly look into XML::Parser's subs style in the future. I don't think this is really the best way to go as I don't know the names of the tags that I'm looking for until runtime. On my test data file there are around 350,000 making me wonder if firing a start tag, end tag, etc handler a good idea.

For the same reasons, I was a bit scared off mirod's idea, there is anywhere between 10 and 30 columns I'm looking for so going through the data file and adding the CDATA sections seems a bit inefficient. I will bear this idea in mind, I'm tempted to try and change the data files to use these.

The best I can come up with is a single loop:

while (/<([^>]+)>/g) { if ($1 eq '/r') { print Dumper(\%temp); undef %temp; } else { next unless $wanted{$1}; if (substr($1, 0, 1) eq '/') { my $text = substr($_,$pos,pos()-$pos-length($1)-2); $temp{substr($1, 1)} = $text; } else { $pos = pos(); } } }

gav^