Name

hex

Synopsis

hex hexnum
                  

Converts a hexadecimal string hexnum into its equivalent decimal value. If hexnum is omitted, it interprets $_. The following code sets $number to 4,294,906,560:

$number = hex("ffff12c0");

To do the inverse function, use:

sprintf "%lx", $number;   # That's a letter 'l', not a one

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.