amudelkaa has asked for the wisdom of the Perl Monks concerning the following question:
The output for the code when I run it is something like...$temp_addr = "A5A5A5A5A5A5A5A5"; $temp_data = "82100000"; my $bc_addr = `echo \"ibase=16;obase=16;($temp_addr/8)\" | bc`; my $bc_data = `echo \"ibase=16;obase=16;($temp_data*200)\" | bc`; die "$bc_data, $bc_addr";
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 I was expecting the o/p in hex and a valid one at that. This one flies over my head. When I run bc in the shell directly things are just fine.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: bc within perl
by Athanasius (Cardinal) on Nov 08, 2016 at 09:22 UTC | |
by amudelkaa (Novice) on Nov 08, 2016 at 09:32 UTC | |
by choroba (Cardinal) on Nov 08, 2016 at 10:06 UTC | |
by amudelkaa (Novice) on Nov 08, 2016 at 13:22 UTC | |
by Corion (Patriarch) on Nov 08, 2016 at 13:27 UTC | |
by choroba (Cardinal) on Nov 08, 2016 at 13:29 UTC | |
| |
|
Re: bc within perl
by hippo (Archbishop) on Nov 08, 2016 at 09:36 UTC | |
by amudelkaa (Novice) on Nov 08, 2016 at 09:40 UTC | |
by pryrt (Abbot) on Nov 08, 2016 at 14:55 UTC |