use IO::Socket::INET6; my $sock6 = IO::Socket::INET6 ->new( '[::1]:12345' ); my $sock4 = IO::Socket::INET6 §§->new( '127.0.0.1:12345' );