Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Sorting Hash / Array

by cdarke (Prior)
on May 16, 2012 at 19:21 UTC ( #970896=note: print w/replies, xml ) Need Help??


in reply to Re^2: Sorting Hash / Array
in thread Sorting Hash / Array

Accepted, but...
the string comparison is not accurate for IP addresses. Originally I was going to do a cascade comparison on each octet, but lost the will to live and suggested Net::IPAddress instead. Inline code can be messy, but I accept your argument about the hard-coded reference.

Replies are listed 'Best First'.
Re^4: Sorting Hash / Array
by sauoq (Abbot) on May 16, 2012 at 20:27 UTC
    the string comparison is not accurate for IP addresses. Originally I was going to do a cascade comparison on each octet, but lost the will to live and suggested Net::IPAddress instead.

    I know. I didn't say anything because A) your suggestion to use Net::IPAddress was better than what I was going to suggest:

    unpack "N", pack "C*", split /\./, $ip_address;
    and B) I was heading out the door. :-)

    -sauoq
    "My two cents aren't worth a dime.";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://970896]
help
Chatterbox?
[james28909]: id just rename the subrouties perl what kind of data they are getting. something easy to remember too. like if get_data were returning movies titles, rename get_data to movies or movie_titles or get_movie_titles.
[james28909]: s/perl/per/
[james28909]: but i dont really know what your end goal is. if it works dont fix it lol

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2017-05-24 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?