On Feb 10, 2006, at 3:58 PM, Eric Lease Morgan wrote:

Now I'm going to make each value in the referenced array a reference to a hash; I'm going to make my data structure deeper. 'More later.

Since that worked so well, I'll ask this question. Given the following data structure, how do I print out something like this:

  tools
    dictionaries
      websters - http://websters.com
      oxford - http://oxford.edu
    catalogs
      und - http://catalog.nd.edu
      worldcat - http://worldcat.com


  my %facets = (

    'tools' => [(

      'dictionaries' => [(
        'websters' => 'http://websters.com',
        'oxford' => 'http://oxford.edu'
      )],

      'catalogs' => [(
        'und' => 'http://catalog.nd.edu',
        'worldcat' => 'http://worldcat.com'
      )]

    )]

  );


This code doesn't cut it:

  foreach my $key (sort(keys(%facets))) {

        print $key, "\n";
        
        foreach my $term (@{$facets{$key}}) {
        
          print "\t", $term, "\n";
        
        }
        
  }


Is my data structure dumb?

--
Eric Morgan

Reply via email to