On Mon, 2011-08-08 at 16:32 -0700, Randal L. Schwartz wrote: > >>>>> "someone" == someone <plu...@robinson-west.com> writes: > > someone> By the way, I can't get Perl's sort function to do the right thing > someone> exactly either. > > someone> my @sorted_ips=sort {$a <=> $b} @ip_list; > > someone> This command sorts the first octet correctly, but not the second, > someone> third, or fourth octets. The numbers are in binary format when sort > > someone> is run on them. > > What is "binary format" > > Show me what might be in $a and $b there, and what order you want them > in.
I saw $a <=> $b described as magic on the web, I know nothing about it. Binary format as in I went from a string to a binary number via: Net::IP::ip_iptobin($ip_string,4); _______________________________________________ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug