Subject: | distinct function does not return last element if it is distinct |
If you pass an array to distinct with the last value being distinct it
is not returned by distinct:
my @foo = qw(a a b c);
my @out = distinct(@foo);
for (@out) { print "$_\n"; }
outputs:
b
need another:
push(@out,$prev) if ($ctr == 1);
right before the return of @out.