in reply to Decoding binary information
Why not use hex?
The first time I encountered it, it seemed like a bit of a misnomer; it actually interprets the given value as a hexadecimal integer, and converts it to decimal (not the reverse, as one might suppose).
For example:
use strict; use warnings; my @values = ( "05F9AD", "F4EC9E", "0005" ); foreach my $value (@values) { my $decval = hex($value); printf "Hex value 0x%08lx = %ld (decimal)\n", $decval, $decval; }
which gives the following results:
Hex value 0x0005f9ad = 391597 (decimal) Hex value 0x00f4ec9e = 16051358 (decimal) Hex value 0x00000005 = 5 (decimal)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Decoding binary information
by njcodewarrior (Pilgrim) on Feb 10, 2007 at 17:49 UTC | |
by bart (Canon) on Feb 10, 2007 at 18:18 UTC | |
by liverpole (Monsignor) on Feb 10, 2007 at 18:11 UTC | |
by njcodewarrior (Pilgrim) on Feb 10, 2007 at 18:25 UTC | |
by liverpole (Monsignor) on Feb 10, 2007 at 18:43 UTC |