in reply to Key/Value pair from GET

I'd recommend HTML::LinkExtor for this, it's the wheel you're reinventing. Its pod gives application examples.

After Compline,
Zaxo

Replies are listed 'Best First'.
better example of what I am trying to do
by inblosam (Monk) on Jun 06, 2002 at 07:29 UTC
    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&sectionId=443&amp;"> <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
      It's not hard to see why your regex goes wrong in the example given. Your regex expects "sectionId=", followed by one or more word characters, followed by a double quote. However, the data has "sectionId=", followed by 443 (which are word characters), followed by an ampersand. An ampersand is of course not a double quote.

      Abigail