Let\'s say I have an array, and I know I\'m going to be doing a lot of \"Does the array contain X?\" checks. The efficient way to do this is to turn that array into a hash, wher
In perl 5.10, there's the close-to-magic ~~ operator:
sub invite_in { my $vampires = [ qw(Angel Darla Spike Drusilla) ]; return ($_[0] ~~ $vampires) ? 0 : 1 ; }
See here: http://dev.perl.org/perl5/news/2007/perl-5.10.0.html