Too dumb for TCP

It seems I'm too dumb for handling raw TCP. Please, dear Internet, teach me what I'm doing wrong!

What I'm trying to do

I want to send some data to Telegraf via TCP. So I open a socket and send the data. All is well, until Telegraf is restarted, thus losing the connection to the sending script. So I want to catch the lost connection, reconnect, and send happily ever after...

The Problem

As soon as I stop Telegraf, the script justs exits, even though the call to send is packed in a lot of eval. So I guess I'm missing something obvious. Please point it out!

The Code

#!/usr/bin/env perl
use strict;
use warnings;

use IO::Socket::INET;

my $socket = IO::Socket::INET->new(
    PeerAddr => 'localhost',
    PeerPort => 8094,
    Proto    => 'tcp',

eval {
    while (1) {
        eval {
            $socket->send("test value=1i");
            print '.';
        warn $@ if $@;
warn $@ if $@;