# # initialization # $self->{'sock'} = IO::Socket::INET->new( args => 'go_here', ) || die "Cant create socket\nReason: $!\n"; # #retrieval for use # $sock = $obj->_get_sock(); sub _get_sock { return($_[0]->{'sock'}); } #### $sock = IO::Socket::INET->new( args => 'go_here', ) || die "blah\n$!\n"; $sock_ref = \$sock; some_func($sock_ref); sub some_func { $ref = shift; $sock = ${$ref}; $line = <$sock>; }