Hi all,
Due to some testing on a live network... (stupid I know) I found a bug in a particular switch we have...(It probably needs a reset I just am not able to save the config anymore) I am not sure if it is because of my script or just the commands I send to the switch but because of it I started to wonder about something.
When you write a script to do something on more than one switch. Would you do it like this:
OR
InDenial
Due to some testing on a live network... (stupid I know) I found a bug in a particular switch we have...(It probably needs a reset I just am not able to save the config anymore) I am not sure if it is because of my script or just the commands I send to the switch but because of it I started to wonder about something.
When you write a script to do something on more than one switch. Would you do it like this:
Code:
use Net::Telnet()
foreach ($key, $value) = each(%hash){
$t->new Net::Telnet()
$t->open($key);
$t->login("user","name");
@lines = $t->cmd("show sys info");
print @lines;
$t->close;
}
OR
Code:
use Net::Telnet();
$t->new Net::Telnet();
foreach ($key, $value) = each(%hash){
$t->open($key);
$t->login("user","name");
@lines = $t->cmd("show sys info");
print @lines;
}
$t->close;
InDenial