in reply to Output to File from Telnet
I think you're making things harder than they need to be. For example, you've got:
foreach my $col (1..4){ #read row column by column use Switch; switch ($col) { #set values for telnet logon for excel row case 1 {$routerip =$Sheet->Cells($row,$col)->{'Value'}} case 2 {$routerun =$Sheet->Cells($row,$col)->{'Value'}} case 3 {$routerlgnpwd =$Sheet->Cells($row,$col)->{'Value'}} case 4 {$routerenpwd = $Sheet->Cells($row,$col)->{'Value'}} }#//switch # skip empty cells next unless defined $Sheet->Cells($row,$col)->{'Value'}; # print out the contents of a cell # printf "%s ", $Sheet->Cells($row,$col)->{'Value'}, $Sheet->Cells($row,$col)->{'Formula'}; }#// For Column
and I think you'd really be better off with:
foreach my $row (1..2) { $routerip = $Sheet->Cells($row,1)->{Value}; $routerun = $Sheet->Cells($row,2)->{Value}; $routerlgnpwd = $Sheet->Cells($row,3)->{Value}; $routerenpwd = $Sheet->Cells($row,4)->{Value}; }
You're also making the code harder to read with your comments, rather than easier to read. It would probably be a lot easier to fix if you cleaned up the indentation and remove most of the comments.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|