Those hex constants represent 64-bit integers. You are using a version of Perl that can only handle 32-bit integers.

Several possibilities exist.

  1. Upgrade to a 64-bit Perl:
    $var1 = 0x0000805063008357 ;; Hexadecimal number > 0xffffffff non-portable at ( $var2 = 0x042426FFFFFFFFFF;; Hexadecimal number > 0xffffffff non-portable at ( printf "0x%0x\n", $var1 ^ $var2;; 0x424a6af9cff7ca8

    The non-portable warnings are just a stupid annoyance that can be suppressed.

  2. Manipulate the hex values as strings:
    $str2 = '042426FFFFFFFFFF';; $str1 = '0000805063008357';; print unpack 'H*', pack( 'H*', $str1 ) ^ pack('H*', $str2 );; 0424a6af9cff7ca8

    Whether that is useful will depend on how you are going to utilise the result?

  3. (Re-)compile your 32-bit version of Perl with use64bitint=define.

    That allows a 32-bit perl to manipulate 64-bit numbers, though you'd probably get those annoying 'non-portable' warnings.

As always, the right solution for your purpose will depend heavily upon that purpose?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^3: Hexadecimal Exclusive OR by BrowserUk
in thread Hexadecimal Exclusive OR by Anonymous Monk

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.