foreach @filterarray { if @mainarray element contains @filterarray element { strip out @filterarray element from @mainarray element} }