Hi I am trying to run 'bc' unix command within perl but that seems really hard right now. I am using bc because the numbers I am using are beyond 64bit in size. Here's a code snippet.
$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";
The output for the code when I run it is something 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 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.

In reply to bc within perl by amudelkaa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.