I think it is easier to calculate "final mac" directly from mac. I used a regex, but I couldn't figure out how to write it so that a final "." didn't appear at the end. I finally gave up and just ran another simple regex to ditch this unintended side effect at the end. I highly suspect that a more advanced regex could have avoided this, but sometimes straightforward is a good answer.
The intermediate atmac is not needed but is easy to calculate with tr. I'm not sure whether or not all 4 of these variants are needed? Or why atmac is in an array. But I figured that "final mac" was the most important.
Anyway another idea for you...
#!/usr/bin/perl
use warnings;
use strict;
my $mac = '28:8a:1c:59:cc:85';
(my $finalmac = $mac) =~ s/(\w+):(\w+)(:?)/$1$2./g;
$finalmac =~ s/.$//; #ditch "." at end
(my $atmac = $mac) =~ tr/:/ /;
print "mac = $mac\n";
print "atmac = $atmac\n";
print "final mac = $finalmac\n";
__END__
mac = 28:8a:1c:59:cc:85
atmac = 28 8a 1c 59 cc 85
final mac = 288a.1c59.cc85
Update: I just noticed the /o in your regex code. Modern Perl doesn't need this hint. I remember bench marking a lot of stuff years ago with Perl 5.10, and I didn't see any difference. Also see
Perl regex documentation 5.22,
" o - pretend to optimize your code, but actually introduce bugs". I would pay attention to a cautionary note like that!