It's much easier to only use IO::Socket:
use strict;
use warnings;
use IO::Socket::INET;
my $server = IO::Socket::INET->new(
LocalPort => 7080,
Listen => 10,
Reuse => 1
) or die $!;
while (1) {
my $client = $server->accept or next;
print $client "foo\n";
}
And if you want to do IPv6 just replace IO::Socket::INET with IO::Socket::IP or IO::Socket::INET6. And if you later want to use SSL on the socket replace it with IO::Socket::SSL and add some certificates. It's a bit overhead but a lot less writing of code and much easier to understand.