I have a list of possible values:
@a = qw(foo bar baz);
How do I check in a concise way that a value $val is present or absent
$val
Interesting solution, especially for repeated searching:
my %hash; map { $hash{$_}++ } @a; print $hash{$val};
If you have perl 5.10, use the smart-match operator ~~
print "Exist\n" if $var ~~ @array;
It's almost magic.