in reply to Multiply Hex values

Numbers exist independently of their (hexadecimal, decimal or other) representations.

From Perldoc: hex interprets EXPR as a hex string and returns the corresponding value.

The hex function *converts a string into a number*, it does not convert an hex number into a decimal number (even though if you print the output of `hex`, it will be printed as a decimal number, this does not imply that they're stored as decimal numbers, as this is irrelevant, they are stored as numbers).

Now, if you want to multiply numbers, they have some how to be numbers. So you need *to convert your strings into numbers* (not decimal or hexadecimal numbers), or at least something that Perl understands as numbers. So converting your hexadecimal strings to numbers is the right way to do it. And, once you've done that, you can multiply your numbers, and then print out the resulting number *value* in any representation you wish, including hexadecimal representation or any other one.

Replies are listed 'Best First'. | |
---|---|

Re^2: Multiply Hex values
by Anonymous Monk on Feb 09, 2017 at 16:13 UTC | |

Re^2: Multiply Hex values
by BillKSmith (Prior) on Feb 09, 2017 at 22:23 UTC |

Comment onRe: Multiply Hex valuesDownloadCode