in reply to Extracting Tag and attributes from a Web Page

Here is an example to get you started, based upon Mojo::DOM:

use strict; use warnings; use feature 'say'; use Mojo::DOM; my $html = '<span class="details-title-text"> <strong>$8.39</strong> </span> <span class="details-title-text"> <strong>$1</strong> </span> <div> <strong>do not find me</strong> </div> <span> <strong>find this</strong> </span>'; my $dom = Mojo::DOM->new( $html ); for my $element ($dom->find('span strong')->each) { say $element->text; }

output:

$8.39 $1 find this

I'll leave determining if the element text is a price as an exercise for you.

Replies are listed 'Best First'.
Re^2: Extracting Tag and attributes from a Web Page
by Kaustubh (Acolyte) on Jul 27, 2016 at 04:44 UTC
    Hi Marto! Thanks for the solution.I am a new user of this forum and I am pretty happy to get such a quick response.