Hexadecimal and octal numbers : hex « Data Type « Perl






Hexadecimal and octal numbers

   

#An integer with a leading 0 is treated as an octal number. 
#An integer with a leading 0x (or 0X) is a hexadecimal number. 

#!/usr/bin/perl -w

$hex = 0xFF;

$octal = 010;

print "0xFF = $hex, 010 = $octal.\n";

   
    
    
  








Related examples in the same category

1.hex("10"), hex("0x10")
2.hex("ab")
3.Convert decimal to hex
4.Illegal Hex number with G
5.Hexadecimal number
6.Using hex function to convert octal number to Hexadecimal number
7.hex digit
8.hex("FFG")
9.hexadecimal data