Well, if you have something like:
my @arr1 = (1,2,3,4,5);
my @arr2 = (6,7,8,9,10);
my @arr3 = (11,12,13,14,15);
my @mainarr = (\@arr1, \@arr2, \@arr3);
Or more simply:
my @mainarr = ([1,2,3,4,5], [6,7,8,9,10], [11,12,13,14,15]);
Then you can check for the existence of an element in each subarray just by deferencing with map:
grep { $_ == $tofind } map { @$_ } @mainarray;
(note the use of '==' instead of a regex to match numbers)
However, that isn't terribly efficient, depending on the nature of the data you're actually searching. Some more context would be helpful here.
|