in reply to Sorting IP Subnets together

I suggest looking at Net::Netmask. I use it a lot and I believe it can help with your problem. If I understand the problem correctly, it may be solved in the synopsis.

-Paul