in reply to bitwise operators

I do something similar to this quite often, and I like to pull the information out of a routing table dump and insert into a Net::Patricia instance.
use Net::Patricia; my $pt = new Net::Patricia; while (<>) { if ( /((?:\d{1,3}\.){3}\d{1,3}\/\d{1,2})/ ) { $pt->add_string($1, 'Inside networks'); } } print "$host: Inside\n" if $pt->match_string($host);
It saves the trouble of worrying about bitwise operations in string or numeric context and makes for a simple way to store and retrieve CIDR block information.