use strict; use IO::Socket::SSL; my $cert = '/path/to/cert.crt'; my ($sock, $s); if(!($sock = IO::Socket::SSL->new( Listen => 5, LocalAddr => 'localhost', LocalPort => 9000, Proto => 'tcp', Reuse => 1, SSL_key_file => $cert, SSL_cert_file => $cert )) ) { warn "unable to create socket: ", &IO::Socket::SSL::errstr, "\n"; exit(0); } while (1) { while(($s = $sock->accept())) { . . . } }