in reply to don't die, retry

Instead of (I presume this is where it's failing):
$sock->send($request) or die "send: $!";
Try something more along the lines of:
unless ($_=$sock->send($request)) { die "send: $!" unless $! =~ /unreachable/; # Or whatever sleep 1; }
Maybe throw a counter in there so it only sleeps/retries a maximum number of times.