#!/usr/local/bin/perl
use warnings;
use strict;
use LWP::Simple;
use HTML::TreeBuilder;
my @files = (["http://microrna.sanger.ac.uk/cgi-bin/targets/v5/detail_
+view.pl?transcript_id=ENST00000226253", "a.txt"],);
for my $duplet (@files) {
mirror($duplet->[0], $duplet->[1]);
};
open DATA, 'a.txt';
my $html = do{local $/;<DATA>};
my $p = HTML::TreeBuilder->new;
$p->parse_content($html); # parse_content if you have a string
my @tds = $p->look_down(_tag => q{td}); # get a list of all the td tag
+s
for my $td (@tds){
my $bold = $td->look_down(_tag => q{b}); # look for a bold tag
if ($bold){
print $bold->as_text, qq{\n}; # if there is one print the text
}
}
$p->delete; # when you've finished with it
so I have the last 2 question, to ask to monks....for today :-) : 1)shall I have to download the content of the web page...to work with filehandle DATA, this is the only way I find to make it works...2) the second question is: how to refine my script to make it prints only the data I need...thanks you all, you are essential for Perl community, and for my bioinformatics work....thanks
|