Hi....I am very new in perl and maybe My question can be very simple...I created hash of hash and I filled it..

But I cannot access any element of it...This is a part of my code;;

%doclen=($putword=>{id => $words[2]});

Can somebody write any sentensize to access any element of ths hash of hash?...

Thanks

Getting the elements from a has within a hash is fairly easy. I'm not sure exactly what you're trying to do here. More information would be helpful.

$foo{a}->{a}=10;
$foo{a}->{c}="a string";

print "$foo{a}->{a}\n";
print "$foo{a}->{c}\n";

Output:
10
a string

Here's an approach using you code:

@words=("one","two","three","four","five");
$putword="hello";
%doclen=($putword=>{id => $words[2]});

print "$doclen{hello}->{id}\n";

Output:
three

BTW, you might check out the code I wrote on the thread "Integrate over two different range and subtract the results of integration and save" and see how I store a hash inside another hash and then passed a reference to a subroutine that dereferenced it. There is a lot of data structure stuff in that script and I think it can help with the idea of a hash inside a hash.

http://www.daniweb.com/forums/thread286658.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.