Help for this page

Select Code to Download


  1. or download this
    sub ip_to_key { sprintf "%03d", split /\./, $_[0] }
    
    my @sortedKeys =
        sort { ip_to_key($ipaddr{$a}) cmp ip_to_key($ipaddr{$b}) }
        keys %ipaddr;
    
  2. or download this
    my @sortedKeys =
        map substr($_, 4),
        sort
        map pack('C4', split(/\./, $ipaddr{$_})) . $_,
        keys %ipaddr;