Copyright © tutorialspoint.com

PERL hex Function


Syntax

hex EXPR

hex


Definition and Usage

Interprets EXPR as a hexadecimal string and returns the value, or converts $_ if EXPR is omitted.

Return Value

  • In scalar context - Numeric value equivalent to hexa.

Example

Try out following example:

#!/usr/bin/perl

print hex '0xAf'; # prints '175'
print "\n";
print hex 'aF';   # same


Copyright © tutorialspoint.com