Is it possible to extract the keys from a multi-dimensional associative array??

Here's the problem, I wrote a parser that dynamically fills an array with keys/values from a file. so I end up with:
$theArray{key1, key2, key3} = value;

but now after the fact I want to access these elements by looping trough the key values ie:
Code:
foreach $key1(??)
  foreach $key2(??)
    foreach $key3(??)
any ideas?

thanks,
Devan