for( 1 .. 2 ){ my $sock = new IO::Socket::INET( 'localhost:12345' ); } ## The first handle was implicitly closed during the second iteration.