Hi all -
I am trying to parse some HTML I grabbed with the WWW:Mechanize class.
Here is the code:
Code:
#!/usr/bin/perl
use strict;
use WWW::Mechanize;
use HTTP::Cookies;
my $outfile = "out.htm";
my $url = "http://mytestpage/";
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
my $output_page = $mech->content();
ParseLines(@$output_page);
print "finsihed\n";
sub ParseLines
{
my (@lines) = @_;
#my ($rx);
my $rx;
my $line;
foreach $line (@lines)
{
if($line =~ m/ReportTitle/){
$rx="found it";
}
}
print $rx;
}
The mechanize part is fine, but i get this for an error:
Code:
mybox:/usr/lib/cgi-bin# perl test5.pl
Can't use string ("<html>
<head>
<!--<meta htt") as an ARRAY ref while "strict refs" in use at test5.pl line 20.
The top of the HTML is
Code:
<html>
<head>
<!--<meta http-equiv="REFRESH" content="; URL=">-->
Any ideas how to get the script to parse it?
Thanks