Using sprint:
$hex = sprintf("%X", 3735928559);Using unpack
$hex = unpack("H*", pack("N", 3735928559));Using Bit::Vector
use Bit::Vector; $vec = Bit::Vector->new_Dec(32, -559038737); $hex = $vec->to_Hex();And Bit::Vector supports odd bit counts:
use Bit::Vector; $vec = Bit::Vector->new_Dec(33, 3735928559); $vec->Resize(32); # suppress leading 0 if unwanted $hex = $vec->to_Hex();