in reply to checking for valid http links
I see your question has already been answered thoroughly by the other fine monks, but I thought I might point out something that wasn't in your question. I notice you're doing a fair amount of directly printing HTML. You've probably heard this a thousand times, but this kind of thing should really be avoided. HTML::Template is my templating tool of choice, and I suggest you check it out. If you don't want the inconvenience of keeping a separate template file (though some may argue embedding the template directly in the Perl code is even less convenient), you can very easily put the text of the template in __DATA__ at the end of the script.
Here's a quick (and very untested) snippet showing how one might do such a thing:
#!/usr/bin/perl use strict; use warnings; use HTML::Template; my $var1 = 'foo'; my $var2 = 'bar'; my $template = HTML::Template->new(filehandle => *DATA); $template->param(var1 => $var1); $template->param(var2 => $var2); print "Content-Type: text/html\n\n", $template->output; __DATA__ <html> <head> <title>Test HTML::Template!</title> </head> <body> <p>Var1 is set to <!-- TMPL_VAR NAME="var1" --><br/> Var2 is set to <!-- TMPL_VAR NAME="var2" --></p> </body> </html>