start page | rating of books | rating of authors | reviews | copyrights

Programming Perl

Programming PerlSearch this book
Previous: 3.2.72 grep Chapter 3
Functions
Next: 3.2.74 import
 

3.2.73 hex

hex 

EXPR

This function interprets EXPR as a hexadecimal string and returns the equivalent decimal value. (To interpret strings that might start with 0 or 0x see oct .) If EXPR 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 an ell, not a one.)


Previous: 3.2.72 grep Programming Perl Next: 3.2.74 import
3.2.72 grep Book Index 3.2.74 import