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


in reply to Re: Allowed VLANs with SNMP
in thread Allowed VLANs with SNMP

Thanks, I think that's exactly what I need.

my $h = "ff00f0fe"; # just 32 bits here, but any other length possibl +e $h =~ s/0x//g; my $b = unpack("B*", pack("H*", $h)); print "$b\n"; # 11111111000000001111000011111110 foreach $idx (1..1023){ my $allowed = substr($b, $idx-1, 1) eq "1"; if ($allowed){print "$idx is allowed\n";} else{print "$idx is not allowed\n";} }