It's funny you say it doesn't merge, I've just copied the code from the post and used Data::Dumper to dump $arr at the end and I can see it merged as it should be..
No, the initial position of the member doesn't matter. If we look at an arbitrary first row of two arrefs:
If the value of the field in $b->[0] matches one already present in $a->[0] then all values in the matching field in the $b->1..$ arrays should be set in the already matched field. So the final array would be like:$a->[0] = [qw/f0 f1 f2 f3/]; $b->[0] = [qw/e0 f2 e1 f0 e2];
a0,1,2.. being the first,second,third element of a $a->[x] array and likewise for the b0,1,2 of the $b->[x] array.$m = [ [qw/f0 f1 f2 f3 e0 e1 e2], [qw/a0 a1 a2 a3 "" "" ""/],# ..and so on all of $a [qw/b3 "" b1 "" b0 b2 b4/],# ..and so on for $b->[1..$]
Does this make it any clearer?
In reply to Re^3: Merging two array(refs)
by kpiti
in thread Merging two array(refs)
by kpiti
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |