[Milan-pm] comparing 2 lists

Paola Bisignano paola.bisignano at gmail.com
Tue Oct 6 03:38:56 PDT 2009


yes I mean that they are not in the same order and I only need to
return the elements that are both in the two array

2009/10/6 Lally Blue <lally22 at gmail.com>:
> are the 2 arrays items in the same order?
> in the reference it says:
> "Internally the comparator compares the two arrays by using join to turn
> both arrays into strings and comparing the strings using eq."
> so I guess that if the first array has 1,2,3,4,5 and the second one
> 5,4,3,2,1 the Array::Compare returns false...
> is this what you mean?
>   -Ilaria-
> On Tue, Oct 6, 2009 at 12:32 PM, Paola Bisignano <paola.bisignano at gmail.com>
> wrote:
>>
>> Hi,
>> I have two lists of numbers, saved in two files and I want to compare
>> them, in order to check which are the same elements in both lists. I
>> put them into array, so I want to compare array, but I only want to
>> check the value, and It doesn't matter for the position in the array,
>> I tried to use Array::Compare
>>
>>
>>
>> open (OUT, "> $file");
>>                                        my $comp = Array::Compare-> new;
>>                                        if ($comp->compare(\@array_num1,
>> \@array_num2))
>>                                                {
>>                                                print "$comp\n";
>>                                                print OUT "$comp\n";
>>                                                }
>>                                        close OUT;
>>
>> but it returns blank, I don't know why...
>> _______________________________________________
>> Milan-pm mailing list
>> Milan-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/milan-pm
>
>
> _______________________________________________
> Milan-pm mailing list
> Milan-pm at pm.org
> http://mail.pm.org/mailman/listinfo/milan-pm
>
>


More information about the Milan-pm mailing list