print hexdigits(324789), "\n"; sub hexdigits { join " ", map {sprintf "0x%02x", $_} unpack("C*", pack "V", $_[0]); } # Prints: 0xb5 0xf4 0x04 0x00