# @quadruple contains longer strings # @triple contains shorter strings foreach $aaaa(@quadruple) { $idx = 0; while ($triple[$idx]) { if ($aaaa =~(/$triple[$idx]/gs)) {push (@common1, $idx); } $idx++; } } foreach $xx(@common1) {splice (@triple,$xx,1) }