The first task here is to work backwards from your Dumper output to something like you have in the actual source code.
In the future, please show us the source code.

I created 3 arrays of references to hash.
When Dumper, dumps those arrays it uses $VARx=reference to array instead of actual names in your source code.
The below shows one possibility.
"Merge" is not right description here, "combine" seems more descriptive.

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @x = ( { 'date' => '2001-06-04', 'number' => '12345', 'amount' => '100.00', 'status' => 'paid', 'type' => 'new' }, { 'date' => '2000-001-02', 'number' => 'xc234', 'amount' => '30.88', 'status' => 'new', 'type' => 'cost' } ); my @y = ( { 'ppay' => 'Smith Doe' } ); my @z = ( { 'deb1' => '0', 'cred' => '0', 'addr' => '100 - Main Street', 'total' => '250.00 usd', }, { 'deb1' => '0', 'cred' => '50.14', 'addr' => '1 - Central', 'total' => '51.00', } ); print "This replicates your dumper output:\n"; print Dumper \@x,\@y,\@z; #This is what you need in your source code: my @combined = (@x,@y,@z); print "\n####### Desired Dumper Output ####\n"; print Dumper \@combined; __END__ This replicates your dumper output: $VAR1 = [ { 'type' => 'new', 'status' => 'paid', 'amount' => '100.00', 'number' => '12345', 'date' => '2001-06-04' }, { 'number' => 'xc234', 'date' => '2000-001-02', 'amount' => '30.88', 'status' => 'new', 'type' => 'cost' } ]; $VAR2 = [ { 'ppay' => 'Smith Doe' } ]; $VAR3 = [ { 'addr' => '100 - Main Street', 'total' => '250.00 usd', 'cred' => '0', 'deb1' => '0' }, { 'addr' => '1 - Central', 'total' => '51.00', 'cred' => '50.14', 'deb1' => '0' } ]; ####### Desired Dumper Output #### $VAR1 = [ { 'type' => 'new', 'status' => 'paid', 'amount' => '100.00', 'number' => '12345', 'date' => '2001-06-04' }, { 'number' => 'xc234', 'date' => '2000-001-02', 'amount' => '30.88', 'status' => 'new', 'type' => 'cost' }, { 'ppay' => 'Smith Doe' }, { 'addr' => '100 - Main Street', 'total' => '250.00 usd', 'cred' => '0', 'deb1' => '0' }, { 'addr' => '1 - Central', 'total' => '51.00', 'cred' => '50.14', 'deb1' => '0' } ];
Update: As a side note: The order that hash keys appear are random. And in more recent Perl's that is guaranteed to be so to prevent certain types of security problems. There is a "fudge factor" that gets added into the hashing function that changes per run of even the same Perl program.

In reply to Re: Merge hashrefs into one by Marshall
in thread Merge hashrefs into one by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.