my @new = my $p = shift @orig; push @new, grep { $p = $_ or 1 if $p ne $_ } @orig;