How to Get Client IP Address in Perl

/*Source:
https://metacpan.org/pod/Net::Address::IP::Local
*/
use Net::Address::IP::Local;
 
# Get the local system's IP address that is "en route" to "the internet":
my $address      = Net::Address::IP::Local->public;
my $address_ipv4 = Net::Address::IP::Local->public_ipv4;
my $address_ipv6 = Net::Address::IP::Local->public_ipv6;
 
# Get the local system's IP address that is "en route" to the given remote
# IP address:
my $address = Net::Address::IP::Local->connected_to($remote_address);