Полезная информация

Programming Perl

Programming PerlSearch this book
Previous: 3.2.72 grepChapter 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 grepProgramming PerlNext: 3.2.74 import
3.2.72 grepBook Index3.2.74 import