Perl has amazing capabilities to generate very complex multi-dimensional data structures. In Perl every dimension until the last one is a reference. Seldom will more than 3 dimensions be needed with the power of the built in data type of hash table especially when combined with Regex. In my example, instead of making a sub-struct with the "data", I just filtered the hash keys to get the "data" keys (data,data1,data3) instead of other keys. This "flattens" the code and reduces one level in the data structure (and very efficiently).
I looks like to me that you just need a hash table with some heterogeneous values, like pointer to array, scalar, etc. This single structure is then represented in an amalgamation as an array them (pointers, "references" to them).