> I don't want the IP addresses to be > printed if they are not unique.
Unless you need to keep the ordering of the values you should use a hash like this. my %data; for (@list_of_ip) { $data{$_} = 1; } my @unique = keys %data; Rob -----Original Message----- From: Dan Anderson [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 12:58 PM To: [EMAIL PROTECTED] Subject: Is there a function to see if something is an element of an array? I have a long list of IP addresses I am going to be reading in (using regexps) and then seperating out into a list of IP addresses. I don't want the IP addresses to be printed if they are not unique. Is there a way to check if a string already has an element in a stack? i.e. push @stack, $_ if is_unique($_, @stack); ? Or would I have to code that myself? -Dan -- 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]