in reply to Re^2: Sorting Hash Value Object's IPv4 Address
in thread Sorting Hash Value Object's IPv4 Address

That's what I initially assumed when I started coding this but you get a shed load of

Argument "^CM-^V" isn't numeric in numeric comparison (<=>) at ...

warnings when you use <=>. That's because inet_aton() is actually returning a packed string. Consider the following:-

johngg@shiraz:~/perl/Monks > perl -MSocket -E ' > say ord for split m{}, inet_aton( q{192.168.45.92} );' 192 168 45 92 johngg@shiraz:~/perl/Monks > perl -E ' > say ord for split m{}, pack q{C4}, split m{\.}, q{192.168.45.92};' 192 168 45 92 johngg@shiraz:~/perl/Monks >

Therefore the cmp comparison is more appropriate.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^4: Sorting Hash Value Object's IPv4 Address
by NetWallah (Canon) on Jan 30, 2016 at 21:22 UTC
    Thanks for the enlightenment (++). I learned something today (always good).

            "I can cast out either one of your demons, but not both of them." -- the XORcist