use print hex $foo instead. See hex.
In reply to Re^3: Escaping a variable by moritz in thread Escaping a variable by Draxter