in reply to Increment MAC address

Note that a MAC address and an IP address are actually not related, except as if through a row in a table.

As for a solution: try turning the hexadicimal string into a number, increment, and convert it back to a hex string:

$next = sprintf "%012x", hex($ip)+1;

Replies are listed 'Best First'.
Re^2: Increment MAC address
by BrowserUk (Patriarch) on Jun 19, 2005 at 11:26 UTC

    Problem.

    printf "%012x\n", hex( 'fffffffffff0')+1;; Integer overflow in hexadecimal number at (eval 23) line 1, <STDIN> li +ne 22. Hexadecimal number > 0xffffffff non-portable at (eval 23) line 1, <STD +IN> line 22. 0000ffffffff

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

        As was pointed out in the other thread--by you I believe.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.