Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Need to calculate IP address

by kcott (Archbishop)
on Dec 28, 2017 at 20:19 UTC ( [id://1206359]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -E 'my @x = split /\./, "10.1.1.5"; $x[3] % 2 ? --$x[3] : ++$x[
    +3]; say join ".", @x'
    10.1.1.4
    $ perl -E 'my @x = split /\./, "10.1.1.6"; $x[3] % 2 ? --$x[3] : ++$x[
    +3]; say join ".", @x'
    10.1.1.7
    
  2. or download this
    $ perl -E 'my @x = split /\./, "10.1.1.5"; $x[3] % 2 ? ++$x[3] : --$x[
    +3]; say join ".", @x'
    10.1.1.6
    $ perl -E 'my @x = split /\./, "10.1.1.6"; $x[3] % 2 ? ++$x[3] : --$x[
    +3]; say join ".", @x'
    10.1.1.5
    
  3. or download this
    $ perl -E 'my @x = split /\./, "10.1.1.0"; $x[3] % 2 ? ++$x[3] : --$x[
    +3]; say join ".", @x'
    10.1.1.-1
    $ perl -E 'my @x = split /\./, "10.1.1.255"; $x[3] % 2 ? ++$x[3] : --$
    +x[3]; say join ".", @x'
    10.1.1.256
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1206359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-19 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found