I'm far too late, my approach is already covered in the posts above. However.
I am translating the integers into a binary representation, pushing it onto each element (just for convenience) and the do a logical bitwise "and" to eliminate the unwanted elements:
use strict;
use warnings;
use List::Util 'sum';
use Data::Dumper;
sub asBinary { sum map { 2**$_ } @_ }
my @AoA = (
[ 2, 13, 3, 16 ],
[ 10, 1, 11, 6 ],
[ 0, 10, 11, 19 ],
[ 6, 1, 19, 15 ],
[ 17, 6, 18, 12 ],
);
push @$_, asBinary( @$_ ) for @AoA;
my $mask = asBinary( @{$AoA[0]}[0..3] );
my @good = grep { ~$mask & $_->[4] } @AoA;
print Dumper \@good;
Clearly, this has an issue if your integers get larger than 31 or 63 depending on your system.