Transform a Perl data structure into one with explicit metadata