Nathan Bailey Nathan.Bailey at
Fri Jan 11 02:46:34 CST 2002

Andrew Gray <agray at> wrote:
>open(LOG, "> deny.log") or die("Cant open deny.log for writing\n");

personally, I like to make liberal use of $!, since it tends to tell
you why it, failed, so:
open(LOG, "> deny.log") or die("Cant open deny.log for writing: $!\n");

>foreach $ip (keys %denylog)

There are two ways to sort a hash -- by key, or by value.  From the
code/your request, it seems you want by key, which is the easier of
the two:

foreach $ip (sort keys %denylog)

but you can also do it by value -- and the man pages tell you how.
	perldoc -f sort
and search for "by value"

>                $deny_list{$ip}='';     # remove it from the %deny_list as
>it has aged out of list

If you really want to remove it, why not
	delete $deny_list{$ip};


More information about the Melbourne-pm mailing list