in reply to Re^2: socket time out
in thread socket time out

It's just missing a ; in the example at the end of the eval closing brace:
eval {
    local $SIG{'ALRM'} = sub { die "Timed out" };
    alarm($timeout);
    while(<$conn>) {
       ....
       alarm($timeout);
    }
    alarm(0);
};
if ($@ =~ /Timed out/) {
    print STDOUT "Timed Out.\r\n";
}