my ( $R_score, @protein, @R_score_protein ); #### my ( @protein, @R_score_protein ); ... push( @R_score_protein, $1 ); #### use Getopt::Long; our URL = "http://www.bork.embl-heidelberg.de/g2d/" . "list_hits_disease.pl?U57042:Inflammatory_bowel_disease_7"; GetOptions( 'url=s', \$URL ) || die ( "Error reading command line args" ); my $browser = LWP::UserAgent->new(); my $resp = $browser->get( $URL ); #### while ( $content_all =~ m{R\-score<\/A>\s=\s(\d\.\d+)\;}g ) { push( @R_score_protein, $1 ); } while ( $content_all =~ m{\[(NP_\d+)\]}g ) { push @protein, $1; } #### my $protein_re = qr|\[(NP_\d+)\]|; my $score_re = qr|R-score\s=\s(\d\.\d+)|; while ( $content_all =~ m{$protein_re} ) ..... while ( $content_all =~ m{$score_re} ) .... #### # $record stores references to hashes, # which are accumulated in @records # my ($record, @records); for my $line ( break_into_lines( $resp->content() ) ) { if ( $line =~ /CANDIDATE/ ) { # # Save previous record, if there is one # if ( defined $record ) { push( @records, $record ); } $records = {}; # assign a new anon. hash. } # In the hash referenced by $record, use the 'protein' key # to access an array into which the $protein is/are added. # while ( my ( $protein ) = ( $line =~ /$protein_re/g ) ) { push( @{ $record->{'protein'} }, $protein ); } if ( my ( $score ) = ( $line =~ /$score_re/g ) ) { push( @{ $record->{'score'} }, $score ); } } #### for my $records ( @records ) { print "Proteins: ", join( ", ", @{ $record->{'protein'} } ), "\n" if ( scalar @{ $record->{'protein'} } ); print "Score: ", $record->{'score'}, "\n"; print "-" x 72; }