I'm using the following code to extract the hidden values from an HTML page. Is there any way that I can extract only specific hidden values or any other values matching the criteria defined in look_down method. In this case I want only recid1,country values
I tried passing array reference to name, but it isn't working for me...any Ideas please
use strict;
use warnings;
use HTML::TreeBuilder;
my $t = HTML::TreeBuilder->new_from_file(*DATA);
my @hidden_inputs = $t->look_down(
_tag => q{input},
type => q{hidden},
name => q{recid1},
);
for my $hidden_input (@hidden_inputs){
printf qq{*%s*\n}, $hidden_input->attr(q{value});
}
__DATA__
<html><head>
<title>Data</title>
</head>
<form name="action">
<table cellspacing="1" cellpadding="1">
<tr>
<td>File name</td>
<td>From To</td>
<td>Svc</td>
<td>Period</td>
<td>Seq#</td>
<td>Reason for Rejection</td>
<td>Next Action</td>
<td>Country</td>
</tr>
<tr>
<td>Sample.XML</td>
<td><a href='dch_redirect?refer=10293377&ref=10293377'>USA-IND</a></
+td>
<td>Voice</td>
<td><input type="hidden" name="recid1" value="10293377">2009/08</td>
<td>03386</td>
<td>data already exists</td>
<td><input type="checkbox" name="c_1"></td>
<td><input type="hidden" name="country" value="America">USA</td>
</tr>
</body></html>