in reply to using unless($code == 200)....

I doubt that's your problem, but here is what I'd use, with a diagnostic:
next if $response == 500; warn "->$response<-\n";
For what it's worth, tye had the best suggestion in that thread. You might also change your loop condition slightly:
while (defined( my $url = <IN> )) { chomp $url;