```{index} single: sockaddr_in6 (Socket) ``` ```{index} single: Socket::sockaddr_in6 ``` # sockaddr_in6 Dual-mode IPv6 shortcut: in scalar context it behaves like `pack_sockaddr_in6`; in list context it behaves like `unpack_sockaddr_in6`. ## Synopsis ```perl my $sin6 = sockaddr_in6($port, $addr); my $sin6 = sockaddr_in6($port, $addr, $scope, $flow); my ($port, $addr, $scope, $flow) = sockaddr_in6($sockaddr); ``` ## What you get back The same values as the underlying `pack_sockaddr_in6` or `unpack_sockaddr_in6`, depending on calling context. ## Examples ```perl my $sin6 = sockaddr_in6(443, inet_pton(AF_INET6, "::1")); ``` ```perl my ($port, $addr) = sockaddr_in6(getpeername($sock)); ``` ## Edge cases - The dispatch is on calling context - list context requires exactly one argument, scalar context two to four; any other count croaks with a usage message. - Prefer the explicit pack/unpack forms in new code. ## Differences from upstream Fully compatible with upstream Socket. ## See also - `pack_sockaddr_in6`, `unpack_sockaddr_in6` - the explicit forms. - `sockaddr_in` - IPv4 counterpart.