http://www.perlmonks.org?node_id=282059


in reply to Re: Return from a subroutine generates a negative value
in thread Return from a subroutine generates a negative value

I understand what you're saying about the random order of hash keys. However, in my situation, its always the first one that succeeds, regardless of which keys its using. The rest always return -1 as the result of the return. I've tried adding hosts to the %nodes hash and always, the first host works, and the rest fail, no matter which host is selected in the first iteration of the for loop. Hosts that failed in a previous run, run properly if they are the first in line.

To plug in some values for the hashes I use (both are declared outside of the for loops), I'm adding this:

my %nodes = ( 'host1' => { 'hardware' => 'servers', 'community' => "$serverCommunity", }, 'host2' => { 'hardware' => 'servers', 'community' => "$serverCommunity", }, ); my %rrd = ( 'real_trend' => { 'free' => $memAvailReal, 'desc' => 'Physical Memory', }, 'swap_trend' => { 'free' => $memAvailSwap, 'desc' => 'Swap Memory', }, );

I just don't think these values matter that much since their order seems unimportant.

I somehow think the issue may be in the snmp session somehow however I have no clue as to why.

Thanks very much for your time on this -c