Conclusion
Perl is well served with modules for subnet manipulation
Personally favour Net::Netmask and NetAddr::IP
All modules in CPAN and Debian
Ipcalc in Debian
Over to Neil and Net::Patricia