for(@sd){ push @out, $_ if (not @out) or ($out[-1] ne $_); }; [download]
update: added (not @out) to initialize array
In reply to Re: Remove Duplicate Lines by fglock in thread Remove Duplicate Lines by dcb0127