diff --git a/Info/Layer2/Allied.pm b/Info/Layer2/Allied.pm index d19e556f..6faf333d 100644 --- a/Info/Layer2/Allied.pm +++ b/Info/Layer2/Allied.pm @@ -93,11 +93,10 @@ sub model { sub root_ip { my $allied = shift; my $ip_hash = $allied->ip_addresses(); - my $ip; my $found_ip; - foreach $ip (values %{$ip_hash}) { - my $found_ip = SNMP::Info::munge_ip($ip) if (defined $ip); + foreach my $ip (values %{$ip_hash}) { + $found_ip = SNMP::Info::munge_ip($ip) if (defined $ip); last; # this is only one IP address } return $found_ip; @@ -106,10 +105,9 @@ sub root_ip { sub mac{ my $allied = shift; my $mac_hash = $allied->ip_mac(); - my $mac; my $found_mac; - foreach $mac (values %{$mac_hash}) { + foreach my $mac (values %{$mac_hash}) { $found_mac = SNMP::Info::munge_mac($mac); last; # this is only one MAC address } diff --git a/Info/Layer2/ZyXEL_DSLAM.pm b/Info/Layer2/ZyXEL_DSLAM.pm index 82b418af..f78523f3 100644 --- a/Info/Layer2/ZyXEL_DSLAM.pm +++ b/Info/Layer2/ZyXEL_DSLAM.pm @@ -104,12 +104,12 @@ sub model { sub ip{ my $zyxel = shift; my $ip_hash = $zyxel->ip_addresses(); - my $ip; + my $found_ip; - foreach $ip (keys %{$ip_hash}) { - my $found_ip = $ip if (defined $ip and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/); + foreach my $ip (keys %{$ip_hash}) { + $found_ip = $ip if (defined $ip and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/); } - return $ip; + return $found_ip; } 1; __END__