#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11132285 use warnings; my @email = ( 'someone@example.co.uk', 'andrew.test@some.company.co.uk', 'jo@abc.com', ); foreach my $em(@email) { print "$em - "; $em =~ s/\w{2}\K(\w*)/ $1 =~ tr!!.!cr /ge; print "$em\n"; }