On Tue, 30 Sep 2003 12:58:21 -0400, Dan Anderson <danmathjunkies.com> wrote:
> 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?
In general this is best handled with a hash, using the keys as the unique string (perldoc -f exists), but in the case this must be an array (not sure of one), perldoc -f grep ... using grep you should be able to create is_unique with one expression...