Hallo,ich möchte einen Hash von Hashes nutzen. Ich kann auch Hashes hinzufügen, doch nicht wieder auslesen. So versuche ich's:
#! /opt/VFD2tools/perl5.8.6/bin/perluse strict;
my $errorcode = "OFF000041";
my %hoh; # hash of hashes
my %writehash;
$writehash{"2008-01-27"} = 45;
$writehash{"2008-01-28"} = 17;
my $itemcount = keys(%writehash);
print "number of entries in writehash: ".$itemcount."\n";
print "number of entries in writehash: ".keys(%writehash)."\n";
print "keys of writehash:\n";
my @hashitems = keys(%writehash);
foreach(@hashitems) {
print "$_\n";
}
$hoh{$errorcode}=%writehash;
my $itemcount = keys(%hoh);
print "number of entries in hoh: ".$itemcount."\n";
print "number of entries in hoh: ".keys(%hoh)."\n";
my %readhash = $hoh{$errorcode};
my $itemcount = keys(%readhash);
print "number of entries in readhash: ".$itemcount."\n";
print "number of entries in readhash: ".keys(%readhash)."\n";
print "keys of readhash:\n";
my @hashitems = keys(%readhash);
foreach(@hashitems) {
print "$_\n";
}
Doch das ist die Ausgabe (writehash und readhash sollten gleich sein):
number of entries in writehash: 2
number of entries in writehash: 2
keys of writehash:
2008-01-28
2008-01-27
number of entries in hoh: 1
number of entries in hoh: 1
number of entries in readhash: 1
number of entries in readhash: 1
keys of readhash:
2/8
Datum: 03.03.2008-21:23
