anniyan has asked for the wisdom of the Perl Monks concerning the following question:
hi monks, i have two arrays namely @a, @b.
@a=(a, b, c, d, e, f); @b=(a, b, c);
In the above array @a wont change throughout the program. Wheras @b may change in the program.
The question is i want to compare both arrays, ie the order of @b elements should be same as @a. Number of elements is not important, only the order should be same. if @b = (c, b, a) then it should return the order is not correct.
I searched methods in List::Compare::Functional, but there is no such method. I can compare this manually with for loops, but i want to know, is there any module to perform this task.
update: If @b = (b, c, d), it is also wrong, because here the order is correct with @a, but a is not there in @b, so it is error, ie it should check from the beginning of @a
Regards,
Anniyan
(CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: List Compare
by borisz (Canon) on Oct 21, 2005 at 14:58 UTC | |
|
Re: List Compare
by BrowserUk (Patriarch) on Oct 21, 2005 at 14:51 UTC | |
|
Re: List Compare
by dragonchild (Archbishop) on Oct 21, 2005 at 14:26 UTC | |
by inman (Curate) on Oct 21, 2005 at 14:32 UTC | |
by sauoq (Abbot) on Oct 21, 2005 at 20:11 UTC | |
|
Re: List Compare
by sauoq (Abbot) on Oct 21, 2005 at 19:45 UTC | |
|
Re: List Compare
by Roy Johnson (Monsignor) on Oct 21, 2005 at 20:55 UTC | |
|
Re: List Compare
by Moron (Curate) on Oct 21, 2005 at 15:37 UTC | |
|
Re: List Compare
by blazar (Canon) on Oct 21, 2005 at 14:24 UTC | |
by Anonymous Monk on Oct 21, 2005 at 14:35 UTC |