This is a better example of what I am trying to do (should have been more clear, sorry). I am trying to get values of variables from a link along with the name of the link (Geography below). This might be in the HTML:
<a href="thepage.jsp?siteId=1§ionId=443&">
<span class="small">Geography</span></a>,
So I want to get 443 and Geography, in the form: 443,Geography. I still get nothing printed out on my command prompt. Here is my modified code to fit this model better:
#!perl
use LWP::Simple;
use strict;
use warnings;
#get the values out easily!
my %categories = ();
my $page = get 'http://www.thepage.com/thepage.html';
while ($page=~m/sectionId\=(\w+?)".+?\"small\">(\w+?)\</sg){
$categories{$1}=$2;
print "[$1] and [$2]";
}
my @pairlist = keys(%categories);
my $idkey = ();
foreach $idkey (@pairlist) {
print "$idkey,$categories{$idkey}\n";
}
Michael Jensen
michael at inshift.com
http://www.inshift.com |