Chose your behaviour:

[0] Perl> $n = 2**32; print $n; print $n >>=1 for 1 .. 32;; 4294967296 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 8388608 4194304 2097152 1048576 524288 262144 131072 65536 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1 [0] Perl> $n = -2**32; print $n; print $n >>=1 for 1 .. 32;; -4294967296 9223372034707292160 4611686017353646080 2305843008676823040 1152921504338411520 576460752169205760 288230376084602880 144115188042301440 72057594021150720 36028797010575360 18014398505287680 9007199252643840 4503599626321920 2251799813160960 1125899906580480 562949953290240 281474976645120 140737488322560 70368744161280 35184372080640 17592186040320 8796093020160 4398046510080 2199023255040 1099511627520 549755813760 274877906880 137438953440 68719476720 34359738360 17179869180 8589934590 4294967295 [0] Perl> { use integer; $n = -2**32; print $n; print $n >>=1 for 1 .. + 32 };; -4294967296 -2147483648 -1073741824 -536870912 -268435456 -134217728 -67108864 -33554432 -16777216 -8388608 -4194304 -2097152 -1048576 -524288 -262144 -131072 -65536 -32768 -16384 -8192 -4096 -2048 -1024 -512 -256 -128 -64 -32 -16 -8 -4 -2 -1 [0] Perl>

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.

In reply to Re: How to do 'unsigned shift right' in perl? by BrowserUk
in thread How to do 'unsigned shift right' in perl? by mattdeans

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.