- or download this
my $string = "name+C.+city+loc.+loc2+++++++++++++++++++++++++B+++v+G++
++";
$string =~ s/\+(?!\+)|\+{3,}.*$/ /g;
print $string, "\n";
- or download this
my @fields = split /\+/, $string, 6;
- or download this
my $parsed = join " ",(split /\+/, $string, 6)[0..4];