cobra2341 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, new to PerlMonk. My question is this. I have a website that I downloaded with LWP and on that page there are about 300 links. What I am trying to do is to have Perl fetch certain links on the site. Thanks updated code
use WWW::Mechanize; use strict; my $m = WWW::Mechanize->new(); $m->get("http://www.thebaseballcube.com/teams/team_32.shtml"); for my $link ($m->links) { #next unless if $link->url() =~ /ad\.php/; print $link->url."\n"; }

Replies are listed 'Best First'.
Re: Filter Data
by erroneousBollock (Curate) on Aug 26, 2007 at 23:35 UTC
    Something like this?

    use WWW::Mechanize; use strict; my $m = WWW::Mechanize->new(); $m->get("http://SERVER/PATH"); for my $link ($m->links) { #next unless GOOD_LINK_CONDITION; print $link->url."\n"; }

    Obviously you need to replace SERVER, PATH, and GOOD_LINK_CONDITION.

    Uncomment the 'next' line to do filtering of your links.

    -David

Re: Filter Data
by FunkyMonk (Bishop) on Aug 26, 2007 at 23:42 UTC
    Hello, and welcome to PerlMonks!

    Have another look at your question, and ask yourself this: If I'd been asked this question, could I answer it?.

    Now think about what would make this an answerable question?

    That's the question to ask!

      ok. Heres is the site http://www.thebaseballcube.com/teams/team_32.shtml If you look on that site, it has prior years, like 2005. When you click that link it goes to another page that has a list of players. When you click on a player it has all there info. What I want perl to do is download that page for all the players for all teh years. thanks
        Ok... so as your next step, show us what you have tried so far.
        (Post your code... please remember to follow the formatting guidelines.)

        -David

        The site has alot of ad hyperlinks and I do not want those. Sorry dhoss
        A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Filter Data
by stonecolddevin (Parson) on Aug 26, 2007 at 23:36 UTC

    You should take a look at PerlMonks FAQ#Posting-on-PerlMonks.

    In order to effectively answer a question like this we'll need to see what you've tried so far and what's your criteria for "certain links".

    meh.
Re: Filter Data
by stonecolddevin (Parson) on Aug 26, 2007 at 23:37 UTC

    You should take a look at the "Posting on Perlmonks" section of PerlMonks FAQ.

    In order to effectively answer a question like this we'll need to see what you've tried so far and what's your criteria for "certain links".

    meh.