Your problem is this line:
%hash=@$row;
It _overwrites_ the hash with the current row, and is why you only have the last value. You should probably instead:
my ( $host, $ip ) = @$row; %hash{$host} = $ip;
I think that should do the trick
In reply to Re: Not able to retrieve hash value outside the function
by Preceptor
in thread Not able to retrieve hash value outside the function
by aniammu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |