in reply to HEX to floating point
You can change the endianess of a whole string of binary data using scalar reverse, so long as you remember to reverse the template and results:
$raw = pack 'H*', '00000034000031b10191403b8811bb1366e4';; print for reverse unpack 'dCCVV', reverse $raw;; 52 12721 1 145 27.53152055
If you're working with large volumes of binary structures, doing it this way can save quite a lot of time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HEX to floating point
by Spooky (Beadle) on Jun 16, 2008 at 14:47 UTC | |
by almut (Canon) on Jun 16, 2008 at 17:50 UTC | |
by Spooky (Beadle) on Jun 16, 2008 at 18:12 UTC | |
by almut (Canon) on Jun 16, 2008 at 18:20 UTC | |
by FunkyMonk (Bishop) on Jun 16, 2008 at 22:37 UTC | |
by Anonymous Monk on Jun 17, 2008 at 09:25 UTC | |
| |
by BrowserUk (Patriarch) on Jun 16, 2008 at 14:57 UTC | |
by Spooky (Beadle) on Jun 16, 2008 at 15:39 UTC | |
by BrowserUk (Patriarch) on Jun 16, 2008 at 15:58 UTC | |
by LittleGreyCat (Scribe) on Jun 16, 2008 at 20:45 UTC | |
|