use strict; use warnings; use LWP::Simple; use HTML::TreeBuilder::XPath; my $url='file:///C:/Users/Rockstar/workspace/abc/globals_func.html'; my $page = get($url) or die $!; my $p = HTML::TreeBuilder::XPath->new_from_content( $page); my @trips= $p->findnodes( '//div[@class="contents"]'); foreach my $trip (@trips){ print $trip->as_text."\n"; }