in reply to Re: Re: parse for string, then print unique
in thread parse for string, then print unique
I note that your original posting kept the strings in original order (by filtering out duplicates assuming they were in sorted order). If that is what you want, any of the solutions involving keys aren't going to do what you want. A hash approach will still work, but goes like this:
or just keep your original grep (unless the strings aren't in sorted order).my %seen; @out = map !$seen{$_}++, @in;
|
|---|