ukhas jean wrote:
> Hello,
>  
> I have an list of version nos. (some version nos. being repetitive) ... 
> like for eg.
> @arr = qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
>  
> I want to get only the unique values in @arr. i.e. version nos. 7.2.0.6 
> and 7.2.0.5
> is there an inbuilt perl-function that does this??
>  
> (PS: I have done this using for and if-loops; but was wondering if there 
> was an easier way)

How about just using a hash:

my @arr = qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
my %h = ();
++$h{$_} foreach @arr;
print "$_\n" foreach sort keys %h;
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to