(note: I didn't write the initial code.) Thanks for the suggestions, and the fix for the warning. :) I'll probably re-write it all, the entire tool set (someday), which is used to index web pages, check broken links, etc. But that's too big of a project for the here and now. :( Just trying to fix the bugs, and memory leaks(!) at the moment. Unless someone knows of a web site crawler that will catch things like missing mouseovers, example:
<script language=javascript><!-- if (document.images) { navigation = new makeimgarray(9) navigation_mo = new makeimgarray(9); navigation[1].src = "/pool/images/psyche//butt_index.gif"; navigation_mo[1].src = "/pool/images/psyche//butt_index.mo.gif"; ... </script>
No link checker I've found will check for the /pool/images/psyche//butt_index.gif image, except for the spagetti I'm having to work with right now. :) Anyhow, here's the changes I made to the gethtml subroutine for your critique:
#/usr/bin/perl -w #gethtml.pl : HTML fetch and return. 28 AUG 2000 use Socket; use strict; sub gethtml { my $my_url = ($_[0]); my $my_host=''; my $my_request=''; my $my_html_return=''; ($my_host, $my_url) = ($my_url =~ m#(.*?)/(.*)#); $my_request = "GET \/$my_url HTTP/1.0\nAccept: */*\nHost: $my_host\nUs +er-Agent: WebMangle/1.0\n\n"; socket(MY_SOCKET, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || retu +rn "Error: $!"; connect(MY_SOCKET, sockaddr_in(80,inet_aton($my_host))) || return "Err +or: $!"; send(MY_SOCKET, $my_request, 0x0); while(<MY_SOCKET>) {$my_html_return .= $_;} close MY_SOCKET || return "Error: $!"; return $my_html_return; } 1;

In reply to Re: Use of unitialized variable? by Arsenal
in thread Use of unitialized variable? by Arsenal

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.