<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: perl telnet on multiple host in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860983#M44879</link>
    <description>Hello Jan,&lt;BR /&gt;&lt;BR /&gt;You can retrieve the content the file using the following method.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use Net::Telnet ();&lt;BR /&gt;&lt;BR /&gt;open(FILE, "telnet.txt") or die("Unable to open file");&lt;BR /&gt;@data = &lt;FILE&gt;;&lt;BR /&gt;&lt;BR /&gt;$ending_value = scalar(@data);&lt;BR /&gt;&lt;BR /&gt;for($counter=0 ; $counter &amp;lt; $ending_value ; $counter++)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;        my $host = $data[$counter];&lt;BR /&gt;        my $username = "user";&lt;BR /&gt;        my $password = "passwd";&lt;BR /&gt;        my $conn = new Net::Telnet (Timeout =&amp;gt; 1,Errmode =&amp;gt; 'return',);&lt;BR /&gt;        $conn-&amp;gt;open($host);&lt;BR /&gt;        $conn-&amp;gt;login($username,$password);&lt;BR /&gt;        print $conn-&amp;gt;cmd('uname -a');&lt;BR /&gt;        $conn-&amp;gt;close();&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;close(FILE);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;use appropriate username and password.&lt;BR /&gt;&lt;BR /&gt;NOTE: You should have installed the Net/Telnet.pm Perl module in your system&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Senthil Murugan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;</description>
    <pubDate>Wed, 15 Sep 2004 06:52:55 GMT</pubDate>
    <dc:creator>Senthilmurugan</dc:creator>
    <dc:date>2004-09-15T06:52:55Z</dc:date>
    <item>
      <title>perl telnet on multiple host</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860982#M44878</link>
      <description>hi all,&lt;BR /&gt;I try  telnet on multiple host with perl. Hosts are stored in hosts.txt but I don't now how to use them. (I can only use ARGV[0] from line)&lt;BR /&gt;telnet.pl 10.3.0.29&lt;BR /&gt;&lt;BR /&gt;----&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use Net::Telnet ();&lt;BR /&gt;&lt;BR /&gt;my $host     = $ARGV[0];&lt;BR /&gt;my $username = "user";&lt;BR /&gt;my $password = "passwd";&lt;BR /&gt;my $conn = new Net::Telnet (Timeout =&amp;gt; 1,&lt;BR /&gt;                          Errmode =&amp;gt; 'return',&lt;BR /&gt;                         );&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;        $conn-&amp;gt;open($host);&lt;BR /&gt;        $conn-&amp;gt;login($username,$password);&lt;BR /&gt;        print $conn-&amp;gt;cmd('uname -a');&lt;BR /&gt;        $conn-&amp;gt;close();&lt;BR /&gt;-----&lt;BR /&gt;&lt;BR /&gt;I tried &lt;BR /&gt;&lt;BR /&gt;for ($i = 0; `cat hosts.txt`; ++$i) but it doesn't work.&lt;BR /&gt;&lt;BR /&gt;How can I retrive hosts form file and use them ?&lt;BR /&gt;&lt;BR /&gt;thank you  &lt;BR /&gt;&lt;BR /&gt;Jan&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Sep 2004 06:09:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860982#M44878</guid>
      <dc:creator>Jan Sladky</dc:creator>
      <dc:date>2004-09-15T06:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: perl telnet on multiple host</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860983#M44879</link>
      <description>Hello Jan,&lt;BR /&gt;&lt;BR /&gt;You can retrieve the content the file using the following method.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use Net::Telnet ();&lt;BR /&gt;&lt;BR /&gt;open(FILE, "telnet.txt") or die("Unable to open file");&lt;BR /&gt;@data = &lt;FILE&gt;;&lt;BR /&gt;&lt;BR /&gt;$ending_value = scalar(@data);&lt;BR /&gt;&lt;BR /&gt;for($counter=0 ; $counter &amp;lt; $ending_value ; $counter++)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;        my $host = $data[$counter];&lt;BR /&gt;        my $username = "user";&lt;BR /&gt;        my $password = "passwd";&lt;BR /&gt;        my $conn = new Net::Telnet (Timeout =&amp;gt; 1,Errmode =&amp;gt; 'return',);&lt;BR /&gt;        $conn-&amp;gt;open($host);&lt;BR /&gt;        $conn-&amp;gt;login($username,$password);&lt;BR /&gt;        print $conn-&amp;gt;cmd('uname -a');&lt;BR /&gt;        $conn-&amp;gt;close();&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;close(FILE);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;use appropriate username and password.&lt;BR /&gt;&lt;BR /&gt;NOTE: You should have installed the Net/Telnet.pm Perl module in your system&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Senthil Murugan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;</description>
      <pubDate>Wed, 15 Sep 2004 06:52:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860983#M44879</guid>
      <dc:creator>Senthilmurugan</dc:creator>
      <dc:date>2004-09-15T06:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: perl telnet on multiple host</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860984#M44880</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;you can do:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;unless (open(FILE, $hostfile)) {&lt;BR /&gt;     print STDERR "Can't open $hostfile\n";&lt;BR /&gt;     return;&lt;BR /&gt;  }           &lt;BR /&gt;  while (my $host = &lt;FILE&gt;) {&lt;BR /&gt;        chop($host);&lt;BR /&gt;   ....&lt;BR /&gt;   here your code&lt;BR /&gt;....             &lt;BR /&gt;}&lt;/FILE&gt;</description>
      <pubDate>Wed, 15 Sep 2004 06:53:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860984#M44880</guid>
      <dc:creator>Slawomir Gora</dc:creator>
      <dc:date>2004-09-15T06:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: perl telnet on multiple host</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860985#M44881</link>
      <description>thanks, it works fine ;-) &lt;BR /&gt;Only my() funct. had to be added&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use Net::Telnet ();&lt;BR /&gt;&lt;BR /&gt;open(FILE, "hosts.txt") or die("Unable to open hosts.txt ");&lt;BR /&gt;my @hosts = &lt;FILE&gt;;&lt;BR /&gt;my $ending_value = scalar(@hosts);&lt;BR /&gt;&lt;BR /&gt;for(my $counter=0 ; $counter &amp;lt; $ending_value ; $counter++)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;my $host = $hosts[$counter];&lt;BR /&gt;my $username = "user";&lt;BR /&gt;my $password = "passwd";&lt;BR /&gt;my $conn = new Net::Telnet (Timeout =&amp;gt;1,  &lt;BR /&gt;                     Errmode =&amp;gt; 'return',);&lt;BR /&gt;$conn-&amp;gt;open($host);&lt;BR /&gt;$conn-&amp;gt;login($username,$password);&lt;BR /&gt;print $conn-&amp;gt;cmd('uname -a');&lt;BR /&gt;$conn-&amp;gt;close();&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;close(FILE);&lt;/FILE&gt;</description>
      <pubDate>Wed, 15 Sep 2004 08:23:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-telnet-on-multiple-host/m-p/4860985#M44881</guid>
      <dc:creator>Jan Sladky</dc:creator>
      <dc:date>2004-09-15T08:23:45Z</dc:date>
    </item>
  </channel>
</rss>

