1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl
use strict;
use warnings;
while(<>){
chomp;
while(/(.*)(\([^\(]+([^\(]+?)+\))(.*)/g){
my $vorn = $1;
my $klammer = $2;
my $hinter = $4;
$klammer =~ s/ /@/g;
$text = $vorn.$klammer.$hinter;
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13
use warnings; use strict; while( my $line = <DATA> ) { chomp $line; $line =~ s/\s(?=[^(]*\))/@/g; print "$line\n"; } __DATA__ aaa bbb ccc (dd ee) (aa bb) (cc dd) eee fff aaa (bb cc) (dd ee ff) ggg