DB<1> my $p; print grep { $p = $_ if $_ ne $p } (a,a,a,a,b,c,c,a,a,d,e,e,e,e); abcade