# convert hex string into a dec number my $dec = hex($mac); # revert into a hex string $mac = sprintf("%012x", $dec+$add);