my $str = 'Internal Computing Department'; my $res = join '' , map {(split //,$_)[0]} split /\s/, $str; # OR my $res = join '' , map { substr $_, 0 , 1 } split /\s/, $str; # OR my $res; $res .= $1 while ( $str=~m/(\S)\S+/g ); print $res;