Hello,

        I have using the following lines to run through an array (@servers) and
run a function on each one. But I want to avoid running the function
twice if an entry exist twice.

I got the following from
http://www.unix.org.ua/orelly/perl/cookbook/ch04_07.htm

But it is not working as expected, even if the array has the first three
entries the same, the function "show_host" gets called three time ?


 foreach $each_server(@servers)
                {
                        unless ($seen{$each_server}) {
                                $seen{$each_server} = 1;
                        show_host($each_server);
                        }
                }

Michael.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Reply via email to