$mac =~ s/(?<=:)(?=[0-9a-fA-F](?::|$))/0/g; $mac =~ s/^(?=[0-9a-fA-F](?::|$))/0/;