in reply to Using a hash key as another hash's name...
The subroutine will see the hashref, so dereference it to get at the rest of the data. And if you really don't need %hash1 by name then, even simpler!my %data; $data{"hash1"} = \%hash1; $data{"hash2"} = \%hash2; $data{"hash3"} = \%hash3; ... for (sort keys %data) { subroutine($_, $data{$_}); }
See perllol and perldsc and perlref for more info.my %data; $data{"hash1"} = { key1 => 25, key2 => 19, ... }; $data{"hash2"} = { key5 => 12, key8 => 'hi', ... }; $data{"hash3"} = { fred => 'flintstone', barney => 'rubble' };
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Using a hash key as another hash's name...
by nega (Scribe) on Sep 04, 2000 at 09:06 UTC |