in reply to Re: comparing the elements of an array
in thread comparing the elements of an array
Hi,
Thanks for your help. But, I thought, I was not clear
in asking my question; sorry for that. I have arrays
of arrays and I want to compare each of the elements
of one array with the elements of the other array.
For example:
@data = (["A", "B", "C", "D", "E", "F", "G"], ["A","C"], ["B","F","G"], ["A","D","E","F","G"], ["D","E","F"], ["G"], ["M", "N", "O"], ["O"], ["M", "N"], ; for $row ( 0 .. $#data ) { for $column ( 0 .. $#{$data[$row]} ) { print "$row $column is $data[$row][$column]\n"; } }I understand till here how to access elements of
arrays of arrays.I would like to compare each of
the element in the array with the elements of the
next array,and depending upon the number of
matches, I would like to print it in the following
way. Any help in this regard would be
appreciated, as i am trying to get a clear concept
of arrays of arrays.
OUTPUT:
A B C D E F G
A D E F G
B E F
A C
G
M N O
M N
O
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: comparing the elements of an array
by Marshall (Canon) on Mar 30, 2010 at 09:19 UTC |