For portability do not assume that the result of inet_aton() is 32 bits wide, in other words, that it would contain only the IPv4 address in network order. #### my $ip = pack(C4 => split /\./, $src);