Dustfinger
07-08-2008, 10:20 PM
I have a hash, %db, and inside it each value is another hash; a hash of hashes.
I'm trying to get a list of the keys of the hash that is returned when you call $db{'someKey'}, but I'm having trouble doing so. Here's the code I've tried:
print "$db{'someKey'}\n";
%temp = $db{'someKey'};
@lookThrough = keys(%temp);
foreach(@lookThrough) {
print "$_\n";
}
@lookThrough being the list of the keys I'm trying to get. But when I run this code, I get the output:
HASH(0x96f5a0)
HASH(0x96f5a0)
The first line is good, it means $db{'someKey'} returns a hash, which is what's expected. But for some reason the keys(%temp) part is just returning %temp, instead of an array of keys. Can anyone help me out with this?
I'm trying to get a list of the keys of the hash that is returned when you call $db{'someKey'}, but I'm having trouble doing so. Here's the code I've tried:
print "$db{'someKey'}\n";
%temp = $db{'someKey'};
@lookThrough = keys(%temp);
foreach(@lookThrough) {
print "$_\n";
}
@lookThrough being the list of the keys I'm trying to get. But when I run this code, I get the output:
HASH(0x96f5a0)
HASH(0x96f5a0)
The first line is good, it means $db{'someKey'} returns a hash, which is what's expected. But for some reason the keys(%temp) part is just returning %temp, instead of an array of keys. Can anyone help me out with this?