http://www.perlmonks.org?node_id=1023624


in reply to Re^5: How to grab a portion of file with regex
in thread How to grab a portion of file with regex

You make some valid points. The example in the question didn't seem to need to content of the div. I do agree that working with the DOM is a much better way to parse HTML. <

:)

#!/usr/bin/perl -- use strict; use warnings; use XML::LibXML; my $dom = XML::LibXML->new( qw/ recover 2 / )->load_html( location => q{junk.html} ); for ( $dom->findnodes(q{ //div[ contains( @class, 'lastUnit' ) ] }) ){ print "\n", $_->nodePath, "\n\n$_\n"; } __END__