in reply to hash of hash of hash of hash of hash...

elofland:

Just a couple minor notes:

  1. Perl automatically creates hash table entries for you if you reference them, so you don't need to explicitly create them. (Search for "autovivification" for details.)
  2. Perl treats an undef as a numeric 0 when you increment the value.

Example:

#!/usr/bin/perl -w use warnings; use strict; my %topHash; # (1) Perl automatically creates the hash table entries as needed # (2) The undef value will be treated as zero, so the result of this # statement is that $topHash{77}{15}{Feb} is 1 ++$topHash{77}{15}{Feb}; for my $k1 (keys %topHash) { for my $k2 (keys %{$topHash{$k1}}) { for my $k3 (keys %{$topHash{$k1}{$k2}}) { print "$k1 / $k2 / $k3 : '$topHash{$k1}{$k2}{$k3}\n"; } } }

So you can simplify the first chunk of your code to:

... while (<FILE>) { my $line=$_; (my $day,$month,$year,$hour,$minute) = ( $line =~ /^.*\[(\d*)\/(.*) +\/(\d*):(\d*):(\d*).*$/); ++$topHash{$year}{$month}{$day}{$hour}{$minute}; } close(FILE);

...roboticus