I would probably do this, although i'm sure some smarty-pants could come up
with a one-liner ;)
sub repeated_elements
{
my %found_one;
for (@_)
{
return 1 if $found_one{$_}++;
}
return 0;
}
if (repeated_elements @whatever)
{
# there are repeated elements
}
else
{
# there are no repeated elements
}
-----Original Message-----
From: GRANATA ROBERTA [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 31, 2001 9:28 AM
To: [EMAIL PROTECTED]
Subject: check array element (HELP)
--- Erhalten von ZBM.ZAGTA 089/32000-414 31-07-01 15.28
hi All,
I have an array of 0...n elements.
I want to check that each element of the array,
must be different to each other.
if it is so -> error,
else -> go on.
please,
Can somebody help me,to write this code.?
thanks in advance,
Best Regards,
roberta
---- 31-07-01 15.28 ---- Gesendet an ------------------------------------
-> beginners(A)perl.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]