Thanks for all the help in the CB but some requested code so here it goes. The bitwise conversion to network from dotted quad works correctly but the bitwise back to dotted quad fails. Below is the code.
sub dotted_quad_to_network { my ($dq_address) = @_; $dq_address =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; return (($1 << 24) + ($2 << 16) + ($3 << 8) + $4); } sub network_to_dotted_quad { my ($address) = @_; return sprintf ("%d.%d.%d.%d", $address >> 24, ($address << 8) >> 24, ($address << 16) >> 24, ($address << 24) >> 24); }
In Perl version 5.8.6 this code works correctly giving the correct dotted quad from the network. In v5.8.8 it gives back a weird dotted quad that looks like this: 216.55333.14165328.3626324100. I am using this IP 216.37.80.132 to test with.

The Web is like a dominatrix. Everywhere I turn, I see little buttons ordering me to Submit. (Nytwind)

In reply to Converting between network and dotted quad. Issue with << and >> operators between Perl Versions. by RoyCrowder

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.