in reply to Taking arbitrary elements from an array

  • Use vec (erm, somehow)

That probably wouldn't make sense unless your mask was an actual bit mask rather than an "integer mask." In other words, if you started with $mask = "\x2b"; rather than $mask = 0x2b; then using vec would be appropriate.

If you took that approach, you could do it like so:

my @arr = qw( and you will be pleased with the results ); my $mask = "\x2b"; my @new = do { my $i = 0; map { vec($mask, $#arr - $i++, 1) ? $_ : () +} @arr };

-sauoq
"My two cents aren't worth a dime.";