Leaving Math::BigInt out of it, you can't have a scalar have a value like "0xdeadbeef" and have perl treat it as
the number 0xdeadbeef; the "0x" header is noticed by the
perl compiler when compiling a constant, and by things
like Math::BigInt::new that explicitly do so, but when
perl numifies a string variable, it only looks for
decimal numbers. So "0xfoo" will only have the "0" part
recognized as a number.
Is there a reason you can't say $predefbi = new Math::BigInt $firststr;?