in reply to Bitwise AND with large numbers
It seems that really you are just dealing with big integers. The hex representation is only a detail. Math::BigInt handles the details of representation for you, provides a bitwise 'and' operation, named band:
use Math::BigInt; my $operand = '0x123456789abcdef0123456789abcdef0'; my $mask = '0x100000000f00000000000000000000f0'; print Math::BigInt->new($mask)->band($operand)->as_hex(), "\n";
Math::BigInt also overloads the '&' operator, so you can do things like this:
my $anded = Math::BigInt->new($mask) & $operand; print $anded->as_hex(), "\n";
Dave
|
|---|