Don't know why you're having problems, but that's because we can't see your @list.

You're trying to open a file with a name found in $list[$j] and it may have illegal characters in it for a start, like a slash. So if the first three succeed, what's in the fourth?

Looking at your whole $i and $j business gets me worried. $i is your incrementing variable, and $j is the name of the file you want to write?

But if you're only incrementing $i by one every time, aren't you going to attempt to get a website at a url which is really a filename next time? Like, if your file contains "http://www.yahoo.com" then "Yahoo", you'd get "http://www.yahoo.com" and write it to a file called "Yahoo.txt" on the first run of the loop, but then the next time you're going to try and get "Yahoo" as a URL, which won't work.

Maybe you're doing some kind of poor-man's hash kind of thing? The key is in $list[$i] and the value is in $list[$j]? In which case, just use a hash!

And, even more to the point, this is a very inefficient way to test if a website has changed, if you're really just going for "either it's changed or it hasn't". Just store the length of the content you get from LWP. If it's different, the site has changed.



($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print

In reply to Re: Source Grabber by Cody Pendant
in thread Source Grabber by Andrew_Levenson

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.