in reply to For each loop through mysql db to run Net::Telnet command

Firstly, add use strict; to turn on strictures as well as warnings

The condition in your while loop - my @row = $sql->fetchrow_array() will load the columns from one row of your database into the array. The next call to fetchrow_array will return the next row until there are no more rows when it returns undef.

So, you need to put your call to telnet in that loop

As it is, you are pulling the list of server_host from the DB and doing nothing with them! By the time the loop exits, you have an undefined value instead of a host value

Replies are listed 'Best First'.
Re^2: For each loop through mysql db to run Net::Telnet command
by jay83 (Novice) on Nov 08, 2022 at 17:56 UTC
    Great thank you for that help!