Close, but not quite. You're trying to store a 48bit number into a 32bit variable. (Well, it's 32 bit on my Windows machine.) You have an overflow problem.
my $dec = hex('FF0000000000'); printf("%012x", $dec); __END__ Integer overflow in hexadecimal number at !.pl line 1 0000ffffffff
You could use Math::BigInt, or you could use floating point numbers (doubles) as I've previously detailed.
In reply to Re^3: How to increment a MAC Address?
by ikegami
in thread How to increment a MAC Address?
by imperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |