Melb.pm meetings
Nathan Bailey
Nathan.Bailey at its.monash.edu
Fri Jan 11 02:46:34 CST 2002
Andrew Gray <agray at netconnect.com.au> 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.
See:
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};
it?
regards,
Nate
More information about the Melbourne-pm
mailing list