This is a snippet of code I've got:
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use Time::Piece;
use HTML::Tree;
my $url0 = 'http://www.website.ch/blah.aspx';
my $doc0 = get($url0);
my $tree0 = HTML::Tree->new();
$tree0->parse($doc0);
my @juice = $tree0->look_down(
_tag => 'option'
);
foreach ( @juice )
{
print $_->as_HTML, "\n";
}
I understand that there are easier ways to do this--feel free to talk about those ways, but I'm doing it this way for now. I would like to put all the value entries into an array, so e.g. if one of my (what I'm calling) look_down tree array elements is the following
<option value="YIDDSH">Yiddish</option>,
then I would like to somehow push "YIDDSH" (without quotes) into an array, and the pull in the next value from the next element in the array.
The simplest way is to use the
attrmethod to extract the contents of thevalueattribute, and the map function to loop over all the elements.