#!/usr/bin/perl use strict; use warnings; use HTML::TreeBuilder::XPath; use LWP::UserAgent ; use HTTP::Request ; open (OUT, '>:encoding(cp1252)',"/home/local/ANT/hemesh/Desktop/test.html"); my $URL = 'http://www.7dayshop.com/delivery-and-returns'; my $agent = LWP::UserAgent->new(agent => "Mozilla/5.0"); my $request = HTTP::Request->new(GET=> $URL); my $response = $agent->request($request); # Check the outcome of the response if ($response->is_success) { my $xp = HTML::TreeBuilder::XPath->new_from_url($URL); my $node = $xp->findnodes_as_string('//strong[contains(.,\'UK Mainland Standard\')]'); print "Content-type: text/html\n\n"; print OUT $node and print $node; } elsif ($response->is_error) { print "Error:$URL\n"; print $response->error_as_HTML; }