Hey Monks! How's it hanging? I'm trying to write a spider that scans user profiles and yields specific data based on their user id numeric values. However, when I create an array with HTML:Parser and the corresponding tokens I only receive the data from the first one even though the arrays are incrementing. Any ideas?
while ($count<=21151){ #create output file if ($append<1) { open(MYOUTFILE, ">newtest2.out"); #open for write, overwrite } else { open(MYOUTFILE, ">>newtest2.out"); #open for write, append } print MYOUTFILE "\n"; #write newline #url is my page $url2[$c2] = "http://www.mysite.com/index.cfm?fuseaction.showme&user= +$count"; #get the data $data2[$c2] = get($url2[$c2]) or die $!; #parse var with data $p2[$c2] = HTML::TokeParser->new(#$data2[$c2]); #get title information from main table while ($token2[$c2] = $p2[$c2]->get_tag("table")) { next unless defined($token2[$c2]->[1]{width}); next unless $token2[$c2]->[1]{width} == "435"; $p2[$c2]->get_tag("td"); $p2[$c2]->get_tag("span");$p2[$c2]->get_ +tag("span");$p2[$c2]->get_tag("\span"); $title2[$c2] = $p2[$c2]->get_trimmed_text; $title[$c1]=$title2[$c2]; $c1++; ... $c2++ $count++;
etc.

2006-03-09 Retitled by planetscape, as per Monastery guidelines
Original title: 'HTML:Parser'


In reply to Accessing elements in array returned by HTML::TokeParser by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.