gnu@perl has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use Fcntl; use NDBM_File; my $configFile = "$ENV{HOME}/\.logmConfig"; my %prefs; tie %prefs, "NDBM_File", "$configFile", O_RDWR|O_CREAT, 0644 or die "C +annot tie to $configFile:\n$!\n"; %prefs = ( 'hopper.uslec.net' => { '/u20/gvc/log/log.log' => 50, '/u20/gvc/log/log2.log' => 12, }, ); print_hash(); untie %prefs; sub print_hash{ my ($server,$log,$lines); foreach $server (keys %prefs) { print "$server\n"; foreach $log ( keys %{ $prefs{$server} } ) { print " $log\n"; print " $prefs{$server}{$log}\n"; } } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using tie on hash of hashes
by Anonymous Monk on Aug 16, 2002 at 16:58 UTC | |
by rob_au (Abbot) on Aug 17, 2002 at 14:57 UTC |