Personally, I prefer your second approach over the regex approach. I would make it a little more brief with sprintf, something like this:
You could argue that it's too compact, but I think the join-map-split idiom is fairly common. YMMV.my $mac_pad = join(':' => map { sprintf "%02s", $_ } split(/:/, $mac));
In reply to Re: Regex overlap in MAC address
by VSarkiss
in thread Regex overlap in MAC address
by superfrink
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |