use strict;
my $str = 'BER_333_10173 - 72 812 1372 2180 2250 87
BER_333_10173 + 72 812 1372 2180 2250 88
BER_333_10173 + 72 812 1372 2180 2250 92
BER_333_10173 - 72 812 1372 2180 2250 93
633310098 + 69,7 909,7 1619,8 2379,8 2430 111
633310098 - 69,8 909,8 1619,8 2379,8 2430 110
633310098 - 69,7 909,7 1619,8 2379,8 2430 97
633310098 + 69,8 909,8 1619,8 2379,8 2430 96
633310099 - 71,11 662,02 1343,05 2050 2100 55
633310099 + 71,11 662,01 1343,08 2050 2100 56
633310099 + 71,11 662,02 1343,05 2050 2100 59
633310099 - 71,11 662,01 1343,08 2050 2100 60
633310108 - 68,7 716 1461 2249 2299 112
633310108 + 68,7 716 1461 2249 2299 113
BER_333_10176 - 153,5 843,5 1503,5 2278,5 2430 119
BER_333_10176 + 153,5 843,5 1503,5 2278,5 2430 120
BER_333_10195 - 72,55 522,53 1172,51 1722,55 1875 63
BER_333_10195 + 72,55 522,53 1172,51 1722,55 1875 64
BER_333_10195 + 72,55 522,53 1172,51 1722,55 1875 61
BER_333_10195 - 72,55 522,53 1172,51 1722,55 1875 62
BER_333_10175 - 99,8 939,8 1899,8 0 1980 125
BER_333_10175 + 99,8 939,8 1899,8 0 1980 126
BER_333_10175 + 99,8 939,8 1899,8 0 1980 123
BER_333_10175 - 99,8 939,8 1899,8 0 1980 124
BER_333_10197 - 62 716 1249 1949 1999 121
BER_333_10197 + 62 716 1249 1949 1999 122
BER_333_10193 - 72,46 522,47 1172,41 1722,43 1875 65
BER_333_10193 + 72,43 522,44 1172,41 1722,43 1875 66
';
my $regex = qr/^(\S*)\s+([\-\+])\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/smp;
my $subst = ';$1\\nLBL $8\\nQ10 = $2 $7 ; Longueur entretoises\\nQ11 = $2 $3 ; TROU 1\\nQ12 = $2 $4 ; TROU 2\\nQ13 = $2 $5 ; TROU 3\\nQ14 = $2 $6 ; TROU 4\\nCALL LBL 1';
my $result = $str =~ s/$regex/$subst/rg;
print "The result of the substitution is' $result\n";
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html