Help for this page

Select Code to Download


  1. or download this
    # create a hash representing @array2
    my %hash;
    ...
    # if an element of array1 is not in array2, it is
    # left in place
    @array1 = grep { not exists $hash{$_} } @array1;
    
  2. or download this
    if($array1[$search] eq $array[$search2]){
        splice(@array1,$search,1); # remove 1 element from index $search i
    +n @array1
        $search--; # the next element is already at $search. decrement so 
    +when it's incremented we'll have the same value.
    }