kiwi_chris:

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.


In reply to Re: Output to File from Telnet by roboticus
in thread Output to File from Telnet by kiwi_chris

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.