At 08:52 PM 6/28/01 -0400, twelveoaks wrote:
>I have a series of variables, say,
> $var0 $var1 $var2 $var3...
>up to lots and lots depending on user input.
>
>They are also available as an array
> @vars = (element1, element2,...)
>
>I want to test to see if any two of their values are identical. Basically
>if the user has made an entry that is not unique he should get an error
>message.
>
>I know how to compare any two of them of course
>
> if ($var1 == $var2) { $youlose = "yes" }
>
>but I don't want to do this over and over again.
>Is there a simple way to, say, compare multiple values to see if any two
>within the group match?
my %h;
@h{@vars} = ();
if (keys %h != @vars) { $youlose = "yes" }
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com