in reply to How to check whether an element is present in an array of array
The direct answer available in perldoc.
@mainarr = (1, 2, 3, 4, 5, 6,7, 8, 9, 10, 11, 12, 13, 14, 15); @is_tiny_prime = (); for (@primes) { $is_tiny_prime[$_] = 1 } # or @istiny_prime[@primes] = (1) x @primes;
Now you check whether $is_tiny_prime[$some_number].
If the number available in array, it print 1, else 0.
|
|---|