my $packet = NetPacket::Ethernet-> decode($raw_packet); my $src_mac = $packet->{src_mac}; # Add separating colons $src_mac =~ s/(..)(?!$)/$1:/g;