http://qs321.pair.com?node_id=1063823


in reply to Boolean array indexing

First shot is to let map do the grep's work:

#! /usr/bin/env perl use strict; use warnings; my @a = ( 6,7,8 ); my @b = ( 3,2,1 ); my @c = map { $b[$_] > 1 ? $a[$_] : () } 0 .. $#a; print "@c\n";