in reply to Mojo::DOM parsing question
#!/usr/bin/perl use strict; use warnings; use feature 'say'; use Mojo::DOM; my $html = '<div class="abstract-content selected" id="enc-abstract"> <p>Secondary bile acids (BAs) and short chain fatty acids (SCFAs), two major types of bacterial metabolites in the colon... </p>'; my $dom = Mojo::DOM->new( $html ); foreach my $abstract ( $dom->find('div.abstract-content > p')->each ){ say $abstract->text; }
Prints:
Secondary bile acids (BAs) and short chain fatty acids (SCFAs), two major types of bacterial metabolites in the colon...
If this isn't what you want/expect please post (or link to) an HTML file you are working with, and clarify your requirements.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Mojo::DOM parsing question
by Anonymous Monk on Jul 17, 2020 at 07:56 UTC | |
by marto (Cardinal) on Jul 17, 2020 at 08:02 UTC | |
Re^2: Mojo::DOM parsing question
by Anonymous Monk on Jul 17, 2020 at 08:17 UTC | |
by hippo (Bishop) on Jul 17, 2020 at 08:26 UTC | |
by marto (Cardinal) on Jul 17, 2020 at 08:29 UTC |
In Section
Seekers of Perl Wisdom