my $sock = IO::Socket->new(...); ${*$sock}{my_connection_data} = 3; ... print ${*$sock}{my_connection_data};