in reply to How to merge/join two multidimensional(2D) arrays
The Excel portion of your question is not related to the merging of two data structures, and might just be distracting you from solving the actual problem. Solve the first problem (the merging) first.
When you say "merge", you mean one of two things; this:
my @merged = ( \@arr, \@arr1 );
...or this...
my @merged = ( @arr, @arr1 );
You probably are after that second option: my @merged = ( @arr, @arr1 );. Currently you have this:
my @merged = ( @arr, \@arr1 );
...which is probably wrong due to its asymmetry.
Once you determine whether you need the first "merge" or the second one, you should then be able to populate the worksheet like this:
$worksheet1->write_col('A3',\@merged);
UPDATE: After looking at your previous post: Simplest way to match/filter 2d array of values to search in perl, I'm wondering if this is what you're doing:
If this sounds familiar, what you are doing is called partitioning. A very capable module for partitioning in Perl is Sort::Key::Top. You might look into it to see if it helps simplify your solution.
Dave
|
|---|