in reply to Array of Hashes
The problem is that ${metadata}{'path'} (which is the same thing as $metadata{path}, since curly brackets around the variable name only serve to disambiguate when it's not clear where the variable name ends), represents a value in the hash %metadata, not a value in a hash pointed to by the scalar reference $metadata. If you were using strict, it would have complained there because %metadata doesn't exist. Presumably you aren't using strict, so it happily creates %metadata on the fly, puts your keys and values in it, and then your other hash that $metadata points to is empty when you push that onto @files.
To access the values in a hash pointed to by a scalar reference, use this format: $metadata->{path}
|
|---|