in reply to Re^2: Infinite Loop Question
in thread Infinite Loop Question

One thing lest the PBP fundamentalists get you - always use a lexical variable in foreach loops:
foreach my $fileToGet (@matches) { ...
What happens if $ftp->get fails? You may want to check whether you get a valid return value e.g.
$ftpReturnVar = $ftp->get($fileToGet, $localFileName); defined $ftpReturnVar or next;

Replies are listed 'Best First'.
Re^4: Infinite Loop Question
by joeymac (Acolyte) on Nov 09, 2011 at 19:44 UTC

    This is actually probably quite helpful! Thanks! I added the line:

    next if ! defined $ftpReturnVar;

    mostly due to personal preference of having an "if" in my conditional statements and restarted to script. It has been running now for several of hours without failure. I will see how it is doing after 24 hours or so. Thanks again for your advice!