At 06:02 PM 6/5/2001 -0700, Philip Peeters wrote:
>Hi,
>
>Is there some magical way to identify unique strings within an array?
>
>
>Example:
>@array = ( "beer","water","wine","beer","wine");
>and I'd like to end up with:  beer, water, wine

{ my %temp;
   @temp{@array} = ();
   @youwant = keys %temp;
}

However, that said, 99 times out of a hundred you should have been keeping 
your data in a hash to begin with and you've made a design error by putting 
it in an array.  Also, the above method doesn't preserve the order.

Reply via email to