in reply to Convert bitwise value to its value

If you trust the input to contain nothing evil, eval will do:
$s = "(1 << 18) | (0x00 << 12) | (0x00 << 6) | 0x00"; printf "0x%x\n", eval $s;