Why convert from hex strings to a number when in the end you compare anyway? Unless you use fancy bitmask arithmetic, just stay with strings:
use constant XXX => 'cccc'; $self->{auth_mode} = lc $val; given ($self->{auth_mode}) { when (XXX) { ... } };
Note that the change from numeric to string comparisons might prove problematic if you have multiple locations where you check for equality with == (and no test suite that smokes out such situations).
In reply to Re: Nicer hex-unpack
by Corion
in thread Nicer hex-unpack
by tritt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |