in reply to bitwise operators
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.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);
|
|---|