Help for this page

Select Code to Download


  1. or download this
    sub parse_ipv4 {
       local *_ = \(@_ ? $_[0] : $_);
       return unpack('N', pack('C4', split(/\./)));
    }
    
  2. or download this
    use Socket ();
    
    ...
       return unless defined $packed;
       return unpack('N', $packed);
    }
    
  3. or download this
    print(parse_ipv4('202.227.44.16'), "\n");
    # 3403885584