On Thu, Sep 08, 2011 at 04:00:43PM +0000, Zhu, Qichao wrote: > There are two arrays > @a = [[a,b,c]...[d,e]...[f]...[g,h]...] > @b = [[...],[...,a,..,c,...,b...],[d],[e],[g...h]...] > > How can I make an arithmetic to detected that. > if (element of array @a include by the element of array @b one time){ > True; > Else { > False ; > }
The Perl FAQ has an article on comparing arrays by converting to hashes. In your case you need to go one step further and convert each sub array with more than one element to a string first using some character that is not in the data set as a separator so the conversion goes both ways. So that @a_new = (qw/ a\b\c ... d\e ... f ... g\h ... /); HTH, Mike -- Satisfied user of Linux since 1997. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/