Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 May 2009 09:45:46 -0700
From:      milk <niteshadez@gmail.com>
To:        Tsu-Fan Cheng <tfcheng@gmail.com>
Cc:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: How to compare two arrays by using perl script?
Message-ID:  <14b7230a0905130945r4142cde4p2a2ac156ff378ba6@mail.gmail.com>
In-Reply-To: <f84c38580905121105q443dd982tb8888d142a6d13d1@mail.gmail.com>
References:  <f84c38580905121105q443dd982tb8888d142a6d13d1@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 12, 2009 at 11:05 AM, Tsu-Fan Cheng <tfcheng@gmail.com> wrote:
> I have two arrays, each has two columns (so its A1, B1 and A2, B2). As
> are the positions while Bs are the values. I need to get the ratio
> between B1 and B2 if their As are the same or close to each other
> within a certain distance.

Well,
You can either compare it by hand or use a module. Use search.cpan.org
to find modules that might be useful. A search for 'Arrays' brought me
Set::Array which as the methods for at, length, intersection, and
union. You can use length and union to find out how many elements in
each array are different. If you want to know how 'close' each A is to
each other, you probably need to compare each element in each
manually.

-- 
milki



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14b7230a0905130945r4142cde4p2a2ac156ff378ba6>