Sosi has asked for the wisdom of the Perl Monks concerning the following question:
Hi guys! I am trying to extract some information from a table in an HTML page. Namely, the small chunk of info that you see under "Representative" in the original website. But, although I *think* I am searching for the correct tag, I think I'm getting the whole file instead? Could you please help me find what I am doing wrong?
Here is the code I have so far. I am sorry if this is such a simple question
#!/usr/local/bin/perl use strict; use warnings; use autodie; use Data::Dump; use HTML::Tree; use LWP::Simple qw(get); my $content=get('http://www.ncbi.nlm.nih.gov/genome/?term=Xylella_fast +idiosa'); my $tree = HTML::Tree->new(); $tree->parse($content); my $data =$tree->look_down( '_tag' =>'div', class => 'genome_descr' ); dd $data;
How would you extract those lines (not the table) into an array? What am I doing wrong in the search?
Thanks in advance! You guys rock!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem extracting an HTML table with Perl
by kennethk (Abbot) on Aug 11, 2014 at 16:47 UTC | |
by Sosi (Sexton) on Aug 11, 2014 at 17:05 UTC | |
by kennethk (Abbot) on Aug 11, 2014 at 17:21 UTC | |
by Sosi (Sexton) on Aug 11, 2014 at 17:56 UTC | |
by kennethk (Abbot) on Aug 11, 2014 at 18:22 UTC | |
|
Re: Problem extracting an HTML table with Perl
by runrig (Abbot) on Aug 11, 2014 at 16:42 UTC |