Net::Telnet in a foreach loop

Discussion in 'Perl Misc' started by HC, Apr 13, 2005.

  1. HC

    HC Guest

    Hi all,

    I wrote a script and I can nog get the errmode to work right but before I
    start asking questions on the errmode problem I wanted to ask another
    question first.

    When doing a script using Net::Telnet to telnet to several hosts where would
    the $obj = Net::Telnet->new( ) be placed in the foreach loop?

    $obj = Net::Telnet->new( );
    foreach $host (@hosts) {
    $obj->open($host);
    #do your login and cmd's here
    }

    OR

    foreach $host (@hosts){
    $obj = Net::Telnet->new( );
    $obj->open($host);
    #do loging and cmd's here
    }

    I asume that using the wrong method might be a reason for the errmode not to
    work right. I am using the first method described right now...

    Thanks for the help.

    HC
     
    HC, Apr 13, 2005
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SnVzdGlu?=

    Problem with foreach loop

    =?Utf-8?B?SnVzdGlu?=, Oct 22, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    437
    Hans Kesting
    Oct 22, 2004
  2. Islam Elkhayat

    loop througth Literials using foreach!!

    Islam Elkhayat, Feb 10, 2005, in forum: ASP .Net
    Replies:
    16
    Views:
    971
    Scott Allen
    Feb 12, 2005
  3. ad
    Replies:
    2
    Views:
    15,369
    Peter Rilling
    Jun 6, 2005
  4. Alan Silver
    Replies:
    2
    Views:
    1,835
    Alan Silver
    Nov 7, 2005
  5. NP
    Replies:
    0
    Views:
    5,592
  6. Jim Isaacson
    Replies:
    5
    Views:
    833
    Default User
    Nov 5, 2004
  7. Carcarius
    Replies:
    0
    Views:
    487
    Carcarius
    Dec 6, 2007
  8. Isaac Won
    Replies:
    9
    Views:
    798
    Ulrich Eckhardt
    Mar 4, 2013
Loading...