for(@sd){ push @out, $_ if (not @out) or ($out[-1] ne $_); };