my $string = "Dies ist ein Test"; my @array = split / /, $string; my $new_string = join "|", @array; print $new_string;