#!/usr/bin/perl -w use strict; # Tasty honey open(DENY, ">>.htaccess") or die "Tried to add host (" . $ENV{REMOTE_ADDR} . ") to deny list, but failed to open file\nError: " . $!; flock(DENY, 2); # <-- Lock the file print DENY "Deny from " . $ENV{REMOTE_ADDR} . "\n"; close(DENY) or die "Tried to close deny list but failed (Host: " . $ENV{REMOTE_ADDR} . ")\nError: " . $!;