#before loop $cntdiff = new Math::BigInt '0'; $predefbi = new Math::BigInt '0'; # inside read loop # for example $firststr = "ffffccbbaa0"; $laststr = "ffffccbbaa9"; # Make sure it is clear that its hex... $firststr = "0x".$firststr; $laststr = "0x".$laststr; $strtcnt = new Math::BigInt $firststr; $endcnt = new Math::BigInt $laststr; $cntdiff = $endcnt - $strtcnt; # the above works OK but if I try something like $predefbi = $firststr; # it doesn't seem to work