open IPFILE,'<',"/tmp/ipfile.txt"; my @ip_list = ; close IPFILE; foreach my $ip_in_list ( @ip_list ) { ... ($session, $error) = Net::SNMP->session( -hostname => $ip_in_list, ... => ..., .. all other options ...; ); $newval = $session->get_request( [-callback => sub {},] [-delay => $seconds,] [-contextengineid => $engine_id,] [-contextname => $name,] -varbindlist => \@oids, ); # now do something with the data found in $newval # use -callback to point to a subroutine where you put further operations to be carried out on $newval }