dannoura has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm trying to look through a two dimensional array and indicate all repeating elements. I'm sure there is some clever way to do it with two lines of code, but I can't think of one.
If I have an array that looks like:
@all=(["what", "is", "the", "matrix"],["matrix", "reloaded", "is", "no", "good"]);I'd like to have an array which looks like:
([0, 1, 0, 1], [1, 0, 1, 0, 0])So that all matches are pointed out. What would be the best way to do this?
p.s. a simple but comprehensive explanation of the map function will also be appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: two dimensional array lookup
by simonm (Vicar) on Jul 17, 2003 at 04:32 UTC | |
by Skeeve (Parson) on Jul 17, 2003 at 06:26 UTC | |
|
Re: two dimensional array lookup
by sgifford (Prior) on Jul 17, 2003 at 04:35 UTC | |
by Skeeve (Parson) on Jul 17, 2003 at 06:31 UTC | |
by ctilmes (Vicar) on Jul 17, 2003 at 10:10 UTC | |
|
Re: two dimensional array lookup
by tos (Deacon) on Jul 17, 2003 at 13:55 UTC |