my $this = sprintf("0x%x", 40); my $that = sprintf("0x%x", 2); my $other = eval "$this + $that"; printf "$other %x\n", $other;