ip_reverse() for IPv4 ignores prefixlen parameter The problem particularly occurs where there are a lot of zeros in the less significant quads. You can use a /number to force retention of those quads in the reversed address but the code was ignoring that instruction. There is some ambiguity over what should happen when the number of bits specified does not fall on a boundary. I have tested with Net::IP::XS and tried to follow what they do.