You say you are converting to hex but then go on to say And using pack and unpack makes them unprintable, which is annoying.
Why not just treat them as strings (these will typically be unprintable) and upack them into hex as requrired for printable output. You can use bitmap operators on strings (with care)
my $num = "\000\001\002\003\004\005\006\007\010\011\012\013"; my ($bin) = unpack "B*", $num; print length $bin, ": ", $bin, "\n"; print printable($num), "\n"; $num |= "\000\001\002\003\004\005\006\007\010\377\012\013"; print printable($num), "\n"; sub printable { unpack "H*", $_[0] }
cheers
tachyon
In reply to Re: Best way to represent somewhat large values in a module
by tachyon
in thread Best way to represent somewhat large values in a module
by sgifford
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |