Help for this page

Select Code to Download


  1. or download this
    my @a_indices = (1,3,5);
    my @b = map {my $t = $_; (grep {$t == $_} @a_indices) ? undef : $t} 0 
    +.. 9;
    
    print join ', ', grep {defined} @b;
    
  2. or download this
    0, 2, 4, 6, 7, 8, 9
    
  3. or download this
    my @a_indices = (1,3,5);
    my %hasIndex = map {$_ => undef} @a_indices;
    my @b = map {exists $hasIndex{$_} ? undef : $_} 0 .. 9;