unix - bc within perl fails to get going -
i trying run bc unix command within perl seems hard right now. using bc because numbers using beyond 64bit in size. here's code snippet.
$temp_addr = "a5a5a5a5a5a5a5a5"; $temp_data = "82100000"; $bc_addr = `echo \"ibase=16;obase=16;($temp_addr/8)\" | bc`; $bc_data = `echo \"ibase=16;obase=16;($temp_data*200)\" | bc`; die "$bc_data, $bc_addr"; the output code when run like...
02 08 20 08 03 09 14 , 02 00 14 05 04 06 12 13 04 04 15 18 07 11 15 02 00 now expecting o/p in hex , valid 1 @ that. 1 flies on head. when run bc in shell directly things fine.
set obase=16 before ibase=16 , work charm. otherwise setting obase 0x16, not want.
Comments
Post a Comment