in reply to Removing certain elements from an array
Notes:my @array = (0,1,2,3,4,5,6,7,8,9); # The source array my %DropList = map {$_ => 1} (2,4,6,8); # A hash of the indices to rem +ove my @newarray = @array[grep {not exists $DropList{$_}} (0..$#array)]; print "@newarray\n";
Russ
Brainbench 'Most Valuable Professional' for Perl
|
|---|