paola82 has asked for the wisdom of the Perl Monks concerning the following question:
Hi dear monks, I'm sorry to disturb you again...for problem solved before...but I have a long script...and I parsed as I did before but...now I don't know why it doesn't work...I'm not able to find the errors...the synthax seems ok...I'll paste an example code, because...the code is too long
#!/usr/local/bin/perl use strict; use warnings; use LWP::Simple; use HTML::TreeBuilder; my $url="http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsu +m/GetPage.pl?pdbcode=1r9t&template=main.html"; my $content=get ($url); my $chain; my @chains; my $p = HTML::TreeBuilder->new; $p->parse_content($content); my @tds = $p->look_down(_tag => q{td}); for my $td (@tds) { my $a = $td->look_down(_tag => q{a}); next unless $a; if ($a) { my $href = $a->attr(q{href}); if ($href =~ /&chain=(\w)"/) { print $1 qq{\n}; $chain=$1; push @chains, $chain; #I want to extract the chains +....A,B,C,D,E,F,H,I,J,K,L } } $p->delete; }
in this part I only want to print and push into an array the chains of the protein....so that my array would be @chains(A,B,C,etc....) but it doesn't work...If anyone could help me...please...I'm running a little crazy...thanks you all
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: problem parsing html
by davorg (Chancellor) on Jul 15, 2009 at 13:46 UTC | |
by paola82 (Sexton) on Jul 15, 2009 at 14:31 UTC | |
Re: problem parsing html
by spx2 (Deacon) on Jul 15, 2009 at 15:12 UTC | |
by missingthepoint (Friar) on Jul 16, 2009 at 09:09 UTC | |
by paola82 (Sexton) on Jul 16, 2009 at 08:37 UTC | |
by spx2 (Deacon) on Jul 16, 2009 at 09:00 UTC | |
by paola82 (Sexton) on Jul 16, 2009 at 10:10 UTC | |
Re: problem parsing html
by Anonymous Monk on Jul 15, 2009 at 13:52 UTC | |
by paola82 (Sexton) on Jul 15, 2009 at 14:33 UTC | |
by Anonymous Monk on Jul 15, 2009 at 14:56 UTC | |
by paola82 (Sexton) on Jul 16, 2009 at 07:53 UTC | |
by Anonymous Monk on Jul 16, 2009 at 08:23 UTC | |
Re: problem parsing html
by Anonymous Monk on Jul 15, 2009 at 15:25 UTC | |
Re: problem parsing html
by Anonymous Monk on Jul 15, 2009 at 15:08 UTC |
Back to
Seekers of Perl Wisdom