Special Formatting for Phone Numbers 

...
    my %rec;
    @rec{@col_names} = @f;
    format_phone($rec{$_}) foreach(qw(ext ddi mobile));
    push @results, \%rec;
...

sub format_phone {
  $_[0] =~ s/\D//g;                  # strip non-digits
  $_[0] =~ s/^(02\d)/$1 /;           # space after 021, 027 etc
  $_[0] =~ s/(\d{4})(\d{4})/$1 $2/;  # 8 digits as: nnnn nnnn
  $_[0] =~ s/(\d{3})(\d{4})/$1 $2/;  # 7 digits as: nnn nnnn
  $_[0] =~ s/(\d{3})(\d{3})/$1 $2/;  # 6 digits as: nnn nnn
}