Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^5: How to increment a MAC Address?

by merlyn (Sage)
on Jun 16, 2005 at 17:53 UTC ( [id://467379]=note: print w/replies, xml ) Need Help??


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

# convert hex string into a dec number my $dec = hex($mac); # revert into a hex string $mac = sprintf("%012x", $dec+$add);
My argument is with the word "dec" there. It's not decimal. It's just a number. In fact, it's more binary than it is decimal. {grin}

The "hex" operator interprets a hex string or an octal string, converting them to a number. A number is an abstraction, without a numeric base, until it gets converted to a string again.

Thus, you never really have a "decimal" number there. Just a number. Because you never printed it out.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-23 21:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found