in reply to logic question

Instead of using arrays just read the text file into a has then you can do something like this. $hash_b{$sql_entry}++ unless exists $hash_a{$sql_entry};