Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
two dimensional array lookupby dannoura (Pilgrim) |
on Jul 17, 2003 at 03:52 UTC ( [id://275102]=perlquestion: print w/replies, xml ) | Need Help?? |
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.
Back to
Seekers of Perl Wisdom
|
|