I think that is probably the clearest way to do it. Here's a way (which I'm not 100% works 100% of the time) that operates on the original list... but as you can see, it's nowhere near as clear:
sub uniq2 {
my @out = ();
my ($a, $lasta);
for ( my $i = 0; $i < @_; $i++ ) {
splice @_, $i--, 1 if defined($lasta) && $_[$i] eq $lasta;
$lasta = $_[$i];
}
return @_;
}
I would stick with something similar to what you have above - it's easy to read, follow and maintain.
Although I'm sure someone else can think of an uber-elegant solution :)
--------------
It's sad that a family can be torn apart by such a such a simple thing as a pack of wild dogs