# thanks to jdporter and ikegami who have shown me a much better way to do this! # # Thanks to ikegami for the code example use Socket qw( inet_aton inet_ntoa ); sub DottedQuadToLong { # Accepts triton.littlefish.ca # Accepts 24.72.30.83 # Accepts 407379539 # etc return unpack('N', inet_aton(shift)); } sub LongToDottedQuad { return inet_ntoa(pack('N', shift)); }