sub port_analyse { my %hash; my %oid_mac; my $z=""; my $item=""; my $oid=""; my $data=""; my $mac=""; my @zeichen; #Make hash for converting ASCII-character to integer (used for MAC readout) for(my $i=0; $i<256;$i++){ $z = sprintf("%c",$i); $hash{$z}=$i; } #foreach $item (@snmp_result_port_mac){ foreach $item (@_){ #Split the OIDs from the VALUEs and save them separate ($oid, $data) = split(/:/, $item, 2); #Perl converts the received data for MAC-Address (normaly returned #as hexadezimal numbers) into strings; this have to be reconverted for( my $i=0;$i<=5;$i++) { #Seperate the 6 characters representing the MAC-Address into array elements $zeichen[$i]=substr($data, $i, 1); } #Convert each character from ASCII-Character to its dezimal number #and convert the number into hexadezimal to get MAC $mac=sprintf("%.2X-%.2X-%.2X-%.2X-%.2X-%.2X\n",$hash{$zeichen[0]}, $hash{$zeichen[1]}, $hash{$zeichen[2]}, $hash{$zeichen[3]}, $hash{$zeichen[4]}, $hash{$zeichen[5]}); (my $port_oid) = split (/1\.3\.6\.1\.2\.1\.2\.2\.1\.6\./, $oid); $oid_mac{$mac} = $port_oid;   ;   ; } return (%oid_mac); } 1;