411 REFERENCE · Wikibooks
Perl Programming/Keywords/hex
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Perl grep if Keywords
The hex keyword
hex interprets the EXPRESSION that follows as a hexadecimal string and returns it as such.
Syntax
hex EXPRESSION
Examples
$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.
Perl grep if Keywords