in reply to foreach problem

It's a problem with Switch or your switch. If I comment out the following bit, it works fine
switch ($i) { case /-U.*/ {print LOG "Adding user to curl\n";$curla.=$i." ";} case /-x.*/ {print LOG "Using proxy for curl\n";$curla.=$i." ";} else {print LOG "Unknown argument: $i\n"} }

Please refer to the BUGS section of the Switch documentation:

There are undoubtedly serious bugs lurking somewhere in code this funky

Update: And here's the immediate cause of the bottom loop existing after one pass:

$ perl -MO=Deparse 707299.pl ... foreach $link (@links) { chomp $link; $response = check_link("$link"); $part = $response; $part =~ s/\r//g; $part =~ s/\n//g; print "1 Empty run\n"; } continue { <------ Added by Switch. last; <------ Causes "for @links" to } <------ exit after first pass.