Welcome to Stack Overflow. You should post what you have tried so far :) then people will understand and help/solve your problem.
If I understood your problem, Let's consider you are having array of array like below. We have to compare both array till the specified index value. So I used the variable name called $matchedColums
. Then we have to make nested loop to compare both array values.
So what I did was, I got the values from the given index and comparing with both values, and pushing into the another array. Then you can get the new array..
use warnings;
use strict;
use Data::Dumper;
my $array = [["0","1","3","some text"], ["0","1","6","more text"], ["1","2","0","and more"]];
my $array1 = [["0","1","3","where missing on page2"], ["0","1","6","to do with it"], ["1","2","0","to read on tuesday"]];
my $matchedColums = 3;
my $mc = $matchedColums-1;
my @finalArray ;
for my $a1 (@{$array}){ #Iterating loop for array elements.
my $matchA1 = join ( "" , @{$a1}[0..$mc] ); # joining the elements from the given index
my @a2String;
for my $a2 (@{$array1}){
my $matchA2 = join ( "" , @{$a2}[0..$mc] );
if ($matchA1 == $matchA2) {
@a2String = @{$a2}[$mc+1..$#$a2];
last;
}
}
my @fn = (@{$a1}, @a2String);
push @finalArray, \@fn; #pushing it as an array reference.
}
print Dumper \@finalArray;