If $returnedData is holding a reference to a hash, you can get the keys of the outer hash by using keys %$returnedData. I'm not sure about the inner hashes, but I think that you could use keys %$returnedData->{..}.
update: sorry, other replies came in while I was typing, that keeps happening to me.