I know you can teach a man to fish, but when you have fish just laying around I feel like I gotta give some away.....
this works for me, do with it what you like

#!/usr/bin/perl -w use strict; use LWP::Simple; use HTML::TokeParser; use HTML::Entities; # @newspages are pages I don't really wanna read, but I'd rather just + have the links my @newspages = qw( http://www.surfstation.lu/00_news.asp http://www.cubadust.com/news.htm http://www.caffemocha.com/cgi-bin/index.htm http://www.halfproject.com/news.php http://www.reinvent.co.nz/v2/skins/news2002.asp ); my $body = <<END_HTML; <html> <head> <title>Silent11 helps out</title> <style> body {margin:0; background-color:e25805;font-family: arial; color:blac +k;font-size:10px;} a {font-family: arial; color: yellow; text-decoration: none; font-size +: 10px;} a:hover {text-decoration: underline overline; background-color:ora +nge} td {font-size:10px; color: darkred;} </style> </head> <body> <table> <tr> END_HTML for (@newspages) { my $html = $_; my ($junk,$short) = split(/\./,$html); # get domain name $body .= "<td valign=top>$short<br>"; my $get = get("$html"); my $p = HTML::TokeParser->new(\$get); while (my $token = $p->get_tag("a")) { my $url = $token->[1]{href} || "-"; my $text = $p->get_trimmed_text("/a"); unless ($url =~ /^mailto|^javascript/){ # don't grab javascri +pt or mailto's (not perfect) $body .= "<a href=\"$url\" target=\"new\">$text</a><br>\n"; } } $body .= "</td>" } $body .= "</tr></table>"; open(OUT,">news.file.html"); # send to an html file print OUT "$body";
-Silent11

In reply to Re: Links by silent11
in thread How to check links on a web page? 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.