ed_r has asked for the wisdom of the Perl Monks concerning the following question:
# in two different config files, a hash of arrays are created then slurped into the dat/eng mapping.%dat_mapping = (); %eng_mapping = ();
foreach my $file_name (key (%dat_mapping)) { print "blah\n"; }
foreach my $file_name (key (sub { if ($hash_name eq 'dat') { return \%dat_mapping; } else { return \%eng_mapping: } } ) { print "blah\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash with sub
by ikegami (Patriarch) on Mar 02, 2010 at 21:29 UTC | |
by ed_r (Initiate) on Mar 03, 2010 at 13:52 UTC | |
|
Re: Hash with sub
by almut (Canon) on Mar 02, 2010 at 21:24 UTC |