hi, i posted a question about mechanize and the $mech->links() method, from what i read that produces a hash refrence to all the links on a page. and in order to get the actual urls its $url = $links->url(); which works fine.. now i have a different problem. im trying to scrape all the links off of a page that contain 6 digits somewhere in the url. however i keep getting duplicates once i print what is in the array, so how would i be able to get rid of the duplicates and save that to another array for later use.. this is the code that i have so far.
$i=1; $mech->get("http://www.somesite.com/"); @links = $agent->links(); foreach (@links) { if ($links[$i]->url() =~ m!(-[0-9][0-9][0-9][0-9][0-9][0-9]*)!) { $links[$i]->url() =~ m!([0-9][0-9][0-9][0-9][0-9][0-9]*)!; $art[$i] = $1; print "$art[$i]\n"; } $i++; }

In reply to Help needed with mechanize by lazybowel

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.