|Don't ask to ask, just ask|
List Compareby anniyan (Monk)
|on Oct 21, 2005 at 14:10 UTC||Need Help??|
anniyan has asked for the
wisdom of the Perl Monks concerning the following question:
hi monks, i have two arrays namely @a, @b.
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