foreach my $key1 (sort(keys(%facets))) { foreach my $key2 (sort(keys(%facets{$key1))) { print " $key1 / $key2 \n"; } }
Spencer On 2/10/06, Eric Lease Morgan <[EMAIL PROTECTED]> wrote: > > How do I loop through a reference to an array? > > I have the following data structure: > > my %facets = ( > 'audiences' => [('freshman', 'senior')], > 'subjects' => [('music', 'history')], > 'tools' => [('dictionaries', 'catalogs')] > ); > > I can use this code to get the keys for %facets: > > foreach my $key (sort(keys(%facets))) { print $key, "\n" } > > But since $key points to the reference of an array, I don't know how > to loop through the referenced array. > > > -- > Eric Lease Morgan > Head, Digital Access and Information Architecture Department > University Libraries of Notre Dame > > (574) 631-8604 > > > > > -- Spencer M. Anspach, Library Systems Analyst/Programmer Library Information Technology, Indiana University Library E456 phone: (812) 856-5318 Bloomington, IN 47405 fax: (812) 856-4979 [EMAIL PROTECTED] pager: (812) 335-7403