ShayShay has asked for the wisdom of the Perl Monks concerning the following question:
UPDATE - I changed @newarray = $v; to @newarray = @$v; and it works. Now I have a boatload of hashes to go through! Thanks to thezip for helping me out!#!/usr/bin/perl -w #use strict; use LWP::Simple; use WWW::Mechanize; use HTML::Form; my $ua = LWP::UserAgent->new; my $response = $ua->get("http://www.ncbi.nlm.nih.gov/sites/entrez? +term=rnr2&cmd=Search&db=nuccore&QueryKey=17"); my @forms = HTML::Form->parse($response); foreach $item(@forms){ #print $item."\n"; while( my ($k, $v) = each %$item ) { #print "key: $k, value: $v.\n"; if ($k eq "action"){ $action = $v; print "\n\n"."ACTION: ".$action."\n"; } if ($k eq "method"){ $method = $v; print "\n\n"."METHOD: ".$method."\n"; } if ($k eq "attr") { print "\n\n"."ATTRIBUTES"."\n"; while( my ($k, $v) = each %$v ) { print "key: $k, value: $v.\n"; } } if ($k eq "inputs"){ print "\n\n"."INPUTS"."\n"; @newarray = $v; foreach $thisItem(@newarray){ print $thisItem."\n"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array Question
by citromatik (Curate) on Feb 12, 2008 at 17:30 UTC | |
|
Re: Array Question
by wfsp (Abbot) on Feb 12, 2008 at 18:03 UTC | |
|
Re: Array Question
by toolic (Bishop) on Feb 12, 2008 at 17:26 UTC | |
|
Re: Array Question
by Erez (Priest) on Feb 12, 2008 at 17:53 UTC |