in reply to 3 dimensional hashes!

You're almost there.

use strict; : : Somewhere there is a loop feeding this : and everything gets defined as appropriate. if ( $tally{$country}->{$error}->{$type} ) { $tally{$country}->{$error}->{$type}++; } else { $tally{$country}->{$error}->{$type} = 1; } : : rest of loop : # print our tallies: foreach my $ctry(keys %tally){ foreach my $error(keys %{$tally{$ctry}} { foreach my $type (keys %{$tally{$ctry}->{$error}){ printf "%s,%s,%s = %d\n",$ctry,$error,$type, $tally{$ctry}->{$error}->{$type}; } } }

disclaimer: Haven't had my coffee yet, and this is totally untested.

Hope this helps!

Replies are listed 'Best First'.
Re: Re: 3 dimensional hashes!
by mark_briscombe (Initiate) on Apr 27, 2004 at 13:14 UTC
    missed a couple of closing } but once those were in worked a treat! many thanks for your help.