You want something called a hash table. In other languages, this data type has other synonyms. In Perl, it's an "associative array". In Python, it's a "dictionary". Etc etc.
If you plan on using Perl, read up on how to use an associative array. Then you will implement pseudocode that looks something like this:
for each ip address in the log file
see if the ip address exists in the hash table
if the ip address does exist
then increment its value by +1
if the ip address does not exist
then make a new entry in the hash table for the ip address
set its starting value to 1
if any entry in the hash table goes over 1000. then do something about it.
You will also need to think of a way to incorporate time into account, since someone could view your page 1000 times over the span of a month, and your program would consider it an attack.
Unless your log file already flushes daily. Then you're set.