in reply to nested hashes or object oriented

Use Data::Dumper to print the hashes out so you can see what gets populated.

use Data::Dumper; print Dumper(\%agency);

That is also the weirdest nested hash syntax I have ever seen. I think it's supposed to look more like this:

$agency{$e4}->{$e7}->{$e6}++;

That change starts to create an interesting hash once it is printed with Data::Dumper. Give it a shot.

Addendum:

Other things I've noticed about your code.

  • In the nested hash example, where are you getting $pf from? Bad cut and paste from the OO version? Did you mean $e6?
  • You are not storing the agency in the first level of the hash(stored in $e3). You may need:
    $agency{$e3}->{$e4}->{$e7}->{$e6}++;
  • The way you are incrementing the counters is incorrect, you want to check those more closely so you get the correct results. Notice that you are storing the current value+1. What you probably wanted was to increment the value in the hash by one AND increment the cumulative count(which I assume the *_count variables are for).
  • Replies are listed 'Best First'.
    Re: Re: nested hashes or object oriented
    by ctilmes (Vicar) on Jun 11, 2003 at 21:32 UTC
      You can also omit superfluous arrows, so
      $agency{$e3}->{$e4}->{$e7}->{$e6}++;
      can be
      $agency{$e3}{$e4}{$e7}{$e6}++;