in reply to Re: snmpwalk in perl
in thread snmpwalk in perl

yes, so sorry for that. Im still in learning phase in perl, i wanted to snmpwalk for 3 to 4 IP's using snmpwalk command and store the result in an array, After that i want to use a 'for' loop to iterate that array and print the output for one IP at a time. I hope u understood my query. I will staring writing the script for one IP. Please correct it
#!/usr/bin/perl use strict; use warnings; my $ip = "199.223.232.10"; my $community = "public"; my $oid = "1.3.6.1.2.1.25.2.2.0"; my @arr = `snmpwalk _v2c _$community _$ip _$oid`; print "@arr";

Replies are listed 'Best First'.
Re^3: snmpwalk in perl
by thanos1983 (Parson) on May 17, 2019 at 17:23 UTC

    Hello again Nouhira,

    On your sample of code you are not using _ (underscores) why on your sample of code you use?

    Does this code compile?

    On my LinuxOS test box your code gives me this error:

    $ perl test.pl _public: Unknown Object Identifier (Sub-id not found: (top) -> _public +)

    Please test your code before posting.

    Hope this helps, Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!