I need an advanced CGI counter that would count unique visitors.

What I want it to do is:
- store visitor's IP address in a seperate file
- if this is a new address the counter then counts +1
- if this visitor already visited my site it doesn't count him

Could anybody help me out with this? ( = write such a script or give me a link to an existing one)?

Thanks in advance!