@arr = qw( and you will be pleased with the results XX YY AA BB ); # \x2b 0 0 1 0 1 0 1 1 0 0 1 0 # \x2b20 0 0 1 0 0 0 1 0 1 0 1 1 $mask = "\x2b20"; @new = do { my $i = 0; map { vec($mask, $#arr - $i++, 1) ? $_ : () } @arr }; foreach (@new) { printf("%s\n", $_); }