in reply to perl quicker than bash?

But I suspect perl could do this even quicker.

Yup, under one second on a really really old laptop to both generate a file of ips and then read and compare then

$ perl -le " for( 1 .. 10 ){ printf qq{%d.%d.%d.%d\n}, $_ , $_, $_, $_ + for 1..255; } warn time-$^T; " > 2 0.265625 at -e line 1. $ perl -lne " $tri = substr $_, 0, 3; if( $tri > 255 ){ die } END{wa +rn time-$^T; } " 2 0.359375 at -e line 1, <> line 2550.