foreach $host ( @hosts ) { my $conn = Net::Telnet::Cisco::IOS->new(HOST => $host); # connect to the host if ( $conn->login( Name => $username, Password => $password)); else( $conn->login( Passcode => $passw));