In my solution, I just constructed a hash having the desired structure. If you want to print it the way you've shown, you only need to pass a ref to this hash to Dumper. In other words, change only the last line:

Data dumper individually dumps each element of @_. A hash is just an array, when read in array context it will read as key, val, key, val..., as seen by Laurent's dump. By passing in a reference to the hash instead, the data structure will be contained in a single dump.