sub myconnect { my ($sock, $addr) = @_; my $newsock = IO::Socket::WhatEver->new($addr); # ... # and what to do next? }