On Sun, 24 Jun 2001, Tim Grossner wrote:

> I am using a for (@targets) loop to connect to cisco routers...if the
> target is unreachable I need it to go on to the next target in the array
> @targets. What should I look for? An "else" statement or what?

You can do something like this:

for(@targets) {

        next if !test_target($_);

        #do more stuff
        ...
}

sub test_target {
        my $target = shift;

        #do things to see if target is reachable
        ...

        if(<test is successful>) { return 1 }
        else { return }
}

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
"All we are given is possibilities -- to make ourselves one thing or another."
-- Ortega y Gasset

Reply via email to