in reply to Re: Best method to eliminate substrings from array
in thread Best method to eliminate substrings from array
Some comments:
In your code here, an input part number group item is treated as a subset of another group only if it is anchored at the left end of the larger group. E.g., the items 7K3377|3H5788 8W1152 4P0489|2757803 added to the list of test input data will not be excluded from output, but, of course, 2N0472|6N8595 2N0472 will be.
In the OPed code, the if-block
if ($strChain ne $_ && index($_, $strChain) >= 0) { $found = true; last; }
implies that a part number group is a subset if it is found anywhere (per the >= comparison) in the larger group (and is not identical to the larger group).
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Best method to eliminate substrings from array
by Paladin (Vicar) on Jun 28, 2019 at 21:39 UTC |