in reply to Re: read IPv4 addresses from array
in thread read IPv4 addresses from array

First of all. Thanks for the answer! I tried to use foreach construction, but get many syntax errors.

Replies are listed 'Best First'.
Re^3: read IPv4 addresses from array
by Corion (Patriarch) on Aug 18, 2015 at 09:06 UTC

    If you want help with these "many syntax errors", you will have to show them to us.

      OMG! It is works! I had a problem like: Global symbol "$s" requires explicit package name at csc-getinfo.pl line 34. because last line was $s->close; Now I rewrite a little bit a script.
      #!/usr/bin/perl use strict; use warnings; use Net::Appliance::Session; my @ipconadd = qw(1.1.1.1 2.2.2.2 3.3.3.3); foreach my $ip (@ipconadd) { print "Processing $ip:\n"; my $s = Net::Appliance::Session->new({ personality => 'ios', transport => 'SSH', host => $ip }); eval { $s->connect({ username => 'login', password => 'password' }); $s->begin_privileged({ password => 'verycoolbro' }); print $s->cmd('show hostname'); print $s->cmd('show inventory | i SN'); $s->end_privileged; $s->close; }; print "IP $ip done.\n"; }; if ($@) { warn "failed to execute command: $@"; }