Perl Programming/Keywords/hex
The hex keyword
edithex interprets the EXPRESSION that follows as a hexadecimal string and returns it as such.
Syntax
edit hex EXPRESSION
Examples
edit $name = "Anton";
print "'" . $name . "', " . hex $name . ",\n\n\n";
$value = "AF";
print $value . ", " . hex $value . "\n";
'Anton', 10AF, 175
The result of hex is the value of the hexadecimal string. $name starts with 'A', which is equal to the hexadecimal digit 0xA. As the rest cannot be interpreted as a number, it is omitted – same for all carriage returns. The hex value of $value is numerically 175, which is returned. Again, the carriage return \n is omitted, as it does not convert to a hexadecimal digit.