in reply to web page source?
Ps. I am always open to suggestions. I'm still pretty new#!/usr/bin/perl -w use strict; use HTML::TokeParser; use LWP::Simple; my $page=get ('http:web.site.here/file.html'); unless (defined ($page)) {die "Unable to retrive page:$!\n";} my @links; #multi demantional array to hold links my $cnt = 0; my $p = HTML::TokeParser->new(\$page); while (my $token = $p->get_tag("a")) { my $url = $token->[1]{href} || "-"; my $text = $p->get_trimmed_text("/a"); $links[$cnt][0] = $text; $links[$cnt][1] = $url; $cnt++; } #sample of accessing links array $cnt =0; my $size = @links; while ($cnt < $size) { print "Text:$links[$cnt][0]\tURL:$links[$cnt][1]\n"; $cnt++; } exit();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: web page source?
by Desdinova (Friar) on Feb 23, 2001 at 02:07 UTC |