note
Corion
<p>The problem is that you are not using <c>strict</c>, or rather, you are not [http://perl.plover.com/FAQs/Namespaces.html|Coping With Scoping]. You actually have two variables <c>$size</c> - one, the global <c>$size</c> which you set to 0 at the top of your program, and another, <c>$size</c>, which you declare in the loop and set it to the length of your data. You should do away with the inner <c>my</c> and the script should work:</p>
<c>
use strict;
use LWP::Simple;
my $size;
my $data2;
while (! length $data2) {
$data2 = LWP::Simple::get($site);
if (! length $data2) {
warn "Couldn't get a response from '$site', sleeping";
sleep 5; # give the website some time
}:
};
...
</c>
539380
539380