in reply to Re: Merging Data
in thread Merging Data

What happens if I don't know the size of $data1 and $data2?
The way it is its only merging the first elements because it has a fixed size to them.

Thanks!

Replies are listed 'Best First'.
Re^3: Merging Data
by trippledubs (Deacon) on Jun 11, 2015 at 13:03 UTC
    If you don't know the size, you can determine at run time by looking. You can always determine the size of an array. If all the referencing is not clear, dereference in multiple steps. Maybe read perldsc, try something new, and/or ask different questions.
    # Get the size of data1 my $sizeOfData1 = scalar @{$data1}; print $sizeOfData1; # Enumerate over each element, a hash reference, of data1 for my $hashref (@{$data1}) { # Dereference the array my %realHash = %{$hashref}; # Dereference the hash }
    Update Fixed code tags