[CrackMonkey] DAPQOTD

Rick Welykochy rick at praxis.com.au
Mon Mar 5 02:52:56 PST 2001


Ben Brockert wrote:

> > 3) Use a multi-dimensional hash rather than the ugly eval() thing.
> >
> >         $count{$year}{$month}{$day} += $bytes;
> >
> >    Isn't that nicer?
> 
> Nicer, yes. How then would I know what to read out?

for my $year (sort {$a <=> $b} $count)
{
    for my $month (sort {$a <=> $b} $count{$year})
    {
        for my $day (sort {$a <=> $b} $count{$year}{$month})
        {
            printf "%04d-%02d-%02d: cunt = %d\n",
                $year,$month,$day,$count{$year}{$month}{$day};
        }
    }
}

or, lisp freaques can use map { ... map { ... map } } without
using cunt.


--
Rick Welykochy || Praxis Services Pty Limited





More information about the Crackmonkey mailing list