Help for this page

Select Code to Download


  1. or download this
    use Socket qw( inet_aton inet_ntoa );
    
    ...
    sub LongToDottedQuad {
       return inet_ntoa(pack('N', shift));
    }
    
  2. or download this
    sub DottedQuadToLong {
       return unpack('N', (pack 'C4', split(/\./, shift)));
    ...
    sub LongToDottedQuad {
       return join('.', unpack('C4', pack('N', shift)));
    }