IP::Decimal - Convert IP to Decimal and Decimal to IP
use IP::Decimal qw/
ipv4_to_decimal
decimal_to_ipv4
ipv6_to_decimal
decimal_to_ipv6
/;
my $decimal = ipv4_to_decimal('127.0.0.1'); # 2130706433
my $ipv4 = decimal_to_ipv4('2130706433'); # 127.0.0.1
This module provides methods for convert IP to Decimal and Decimal to IP, simply and directly.
my $decimal = ipv4_to_decimal('127.0.0.1');
Returns the decimal: 2130706433
my $ip = decimal_to_ipv4('2130706433');
Returns the IP 127.0.0.1
my $decimal = ipv6_to_decimal('dead:beef:cafe:babe::f0ad');
Returns the decimal: 295990755076957304698079185533545803949
my $ip = decimal_to_ipv6('295990755076957304698079185533545803949');
Returns the IP dead:beef:cafe:babe::f0ad
Lucas Tiago de Moraes lucastiagodemoraes@gmail.com
This software is copyright (c) 2020 by Lucas Tiago de Moraes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.