How about just: @list = (qw(two one none zero seven two zero))
foreach my $elem ( @list ) {
$list{$elem}++;
}
@list = ();
foreach my $key ( keys %list ) {
push(@list,$key);
}
To explain:
Each non-unique element in the list will simply increment the unique
hash key, then read back all the hash keys into your list.
On Thu, 2003-07-24 at 12:23, Charles K. Clarkson wrote:
> Juergen Bertram wrote:
> :
> : hi,
> :
> : I need a procedure to eleminate dupes in a @list
> :
> : Ex: @list1 = qw(two one two zero six five six seven zero);
> :
> : should be changed to:
> :
> : @list2 = qw(two one zero six five seven);
> :
> : There's no need to sort the list.
>
> Quantum::Superpositions is a staggeringly difficult
> read, but I was able to hear a lecture a few years
> ago by Damian Conway. It can handle this job, but
> don't ask me to explain exactly how it works:
>
> use Quantum::Superpositions qw| eigenstates any |;
>
> my @not_unique = qw|two one two zero six five six seven zero|;
>
> my @unique = eigenstates( any( @not_unique ) );
>
> print Dumper [EMAIL PROTECTED];
>
>
> One advantage is that this method is
> it will run instantaneously on a quantum
> computer.
>
>
>
> HTH,
>
> Charles K. Clarkson
> --
> Head Bottle Washer,
> Clarkson Energy Homes, Inc.
> Mobile Home Specialists
> 254 968-8328
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
signature.asc
Description: This is a digitally signed message part
