Some preliminary points:
- For future reference, please read Writeup Formatting Tips and enclose your code in <code>...</code> tags.
- I don’t know of any Perl command named errexit?
- flock is for preserving data integrity in a multithreaded environment. It is not a tool for enforcing security by locking users out. (You may well be on top of this, but from the question asked and the snippet given, it’s hard to be sure.)
- Please don’t give your email address, or request private correspondence. That’s not how the Monastery works. Once a thread is started, the discussion is available for everyone to read — and benefit from.
Now to the question. Create a hash, say %ip, and update it each time a visitor attempts to verify an account number:
++$ip{$ip_address};
Then grant access or not, as follows:
if ($ip{$ip_address} < 4)
{
# Grant access
}
else
{
# Show an error message
}
Hope that helps,