Help for this page

Select Code to Download


  1. or download this
    sub ip_cmp ($$) {
      my @a = split /\./, $_[0];
    ...
          || $a[3] <=> $b[3];
    }
    
  2. or download this
    my @sorted_keys = sort { ip_cmp($hash{$a}->ip_address, $hash{$b}->ip_a
    +ddress) } keys %hash;
    
  3. or download this
    use Sort::Key::IPv4 qw(ipv4keysort);
    my @sorted_keys = ipv4keysort { $hash{$_}->ip_address } keys %hash;