in reply to Re^2: Array reference
in thread Array reference
From the input and desired output you posted, it appears that you want to sort on the last field in each array, then remove any row based on the difference in that last field. Is that correct ?
First, my @s_arr2 must be declared for this line@s_arr2=sort{$a<=>$b}@arr2;
Then, on this lineif(abs($l2[3]-$l1[3]) <= 500 && $l1[6] eq $l2[6])
are you intending to subtract text fields in the abs section ? Based on your data, you're subtracting "mir" from "mir" because Perl array indices start with zero.Also on that same line, if you meant
abs($l2[2]-$l1[2]) <= 500to do subtractions on the 70, 90, 100, 120 values, those differences won't come close to 500, so no row would be deleted based on that result.
|
|---|