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

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

Replies are listed 'Best First'.
Re^4: read IPv4 addresses from array
by andreyns (Initiate) on Aug 18, 2015 at 09:50 UTC
    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: $@"; }