#!/usr/bin/perl open in,"987.txt" or die " could not open 987.txt as input"; # assign bit mask for this area code and pack it to binary $a = "00000001"; $b = pack('b8',$a); # load an array with the phone number less the area code as the subscript @arr; while (){ chomp; $arr[$_]=$b; } # takes time to load about 10 seconds for all 10 million recs print "\n\narray loaded\n"; # response for lookup is sub-second while (true){ print "enter phone number: "; $pni = <>; chomp $pni; $pna = unpack('b8',$arr[$pni]); if (substr($pna,7,1) eq "1" ){ print "on file\n"; }else{ print "not on file\n"; } }