Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: How to increment a MAC Address?

by rob_au (Abbot)
on May 23, 2005 at 09:33 UTC ( #459481=note: print w/ replies, xml ) Need Help??


in reply to Re: How to increment a MAC Address?
in thread How to increment a MAC Address?

The components of a MAC address, when expressed as a group of six octet values, are expressed as hexadecimal values (eg. FE:DC:BA:01:23:45) - Your code does not account for this with the maximal octet value of 99 (decimal) provided by your code.

Although in stating this, I should note that this is a problem too with the problem description in the original thread post.

 

perl -le "print unpack'N', pack'B32', '00000000000000000000001000000000'"


Comment on Re^2: How to increment a MAC Address?
Replies are listed 'Best First'.
Re^3: How to increment a MAC Address?
by imperl (Novice) on May 23, 2005 at 10:30 UTC
    yes, i know 99 is not valid, just that im simulating something out here, where i require the value as 99 and not in hex.
      if $_ holds your string, then this should increment it
      $_ = join ":",unpack "A2"x6, substr( ('0' x 12 . (1 + join '',split /:/,$_))), -12)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (16)
As of 2015-07-31 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls