This is the output on my machine (with a 64bit Perl and OS):
c = 97; hash = 61, masked hash = 61 c = 99; hash = 611842, masked hash = 611842 c = 99; hash = 613026f8a1, masked hash = 3026f8a1 c = 101; hash = 3032d2383004, masked hash = d2383004 c = 112; hash = d26bebd7d16c, masked hash = ebd7d16c c = 116; hash = ec11db888a08, masked hash = db888a08

(where the hashes are in hexadecimal, and c in decimal).

I'm not sure if that's the right explanation, but maybe the multiplication of a large number with 2**16 causes an automatic upgraded to floating point numbers on your (32bit) platform.

You can verify this assumption by using Devel::Peek, and Dump the variable $hash after each iteration. It prints (PADMY,IOK,pIOK), and if my guess is right, it will print (PADMY,NOK,pNOK) on your platform.

You could try to avoid that by using strings, and bit shifts instead of multiplications. But I'm sure other monks have more experience with bit manipulation magic than I have. Another (but probably inefficient) solution is to use bigint.

Perl 6 - links to (nearly) everything that is Perl 6.

In reply to Re: Bitwise & stopped working? by moritz
in thread Bitwise & stopped working? by Krokus

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.