in reply to Need to calculate IP address

this just leaves '$bgp_ip' blank

Sorry, I can't reproduce this, your code actually works for me. Perhaps you just made a typo? Always Use strict and warnings! However, at the moment the code is doing the same as tybalt89's XOR solution (Update: at least on your sample input that is) - if you want the logic to be the way you describe (.5 becomes .6 and vice versa), you need to reverse the +/- operations. On the other hand, tybalt89 made a good point here - are you sure about the logic you described?

Replies are listed 'Best First'.
Re^2: Need to calculate IP address
by ddrew78 (Beadle) on Dec 28, 2017 at 19:52 UTC
    I did notice that I had the + and - reversed by accident. This was incorrect in my initial code and has been corrected there as well. However, even with that correction, my variable '$bgp_ip' still has no value.
      my variable '$bgp_ip' still has no value

      I just re-downloaded the code from the root node and ran it, the only change I made was to add a print of $bgp_ip, and that variable is definitely not empty. So either the code you have posted here is not the code you are running, or there is some other mistake - for example, perhaps you have a typo in the variable name that is not being caught due to a missing strict. Please either post the actual code you are running or use the tips from the Basic debugging checklist to hunt down the problem in your code.