help parsing HTML code

Andy Farrior (afarrior@vc.cc.tx.us)
Wed, 31 Jan 2001 12:46:21 -0600


Greetings,

I'm trying to read the following HTML code:

<input type="text" size="10" name="video_fec_errors_rx" value="24" READONLY>

I need to extract the value for video_fec_errors_rx.  I can't seem to 
figure out how to do it.  (This is the first time I've tried to use the LWP 
library.)

The web server I'm connecting to uses one form to display various values.

I think I need to use the HTML::Parse or HTML::TreeBuilder modules, but I 
get stuck really quick.

I know this a newbie question; so please be kind.

Thanks,
Andy

#!/usr/bin/perl
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);

[snip]

$URL = "http://$USERID:$PASSWORD\@$HOST/a_advannetstat.htm";

my $req = new HTTP::Request GET => $URL;
my $res = $ua->request($req);

if ($res->is_success) {
     $content = $res->content;
     print "$content\n";
} else {
     print "Can't reach $HOST\n";
}