in reply to using a hexadecimal mask to create a list of values (that the mask is pointing to)
Short answer: the hex function will convert your strings into hex numbers.
@numbers = (); for (@list) { push @numbers, hex $_; }
Perl has an internal representation of hex numbers, where each term starts with 0x, so your list would be
@list = (0xA, 0x6, 0x5, 0x5, 0x4, 0x5, 0x0, 0xE)
Note that simply concatenating a 0x to the front of your string will not work. As well, I played a bit with pack and unpack, and while in theory you can get similar functionality, I couldn't seem to get my expressions right.
Update:Once you have your values in integer format, you can use the bit shift and mod operators to extract the info you actually care about
my $value = 14; #Examine 3rd bit from the right print ($value >> 3) % 2;
|
|---|