⭐ in reply to How to find out if X is an element in an array?
The above code returns 1 if element found, undef if not found.$X = "x"; @array = qw / x y z 1 2 3 /; return exists {map { $_ => 1 } @array}->{$X};
In Section
Seekers of Perl Wisdom
⭐ in reply to How to find out if X is an element in an array?
The above code returns 1 if element found, undef if not found.$X = "x"; @array = qw / x y z 1 2 3 /; return exists {map { $_ => 1 } @array}->{$X};