Hello everybody. Lets explain my problem. Lets see the folowing perl 5 program :
#!/usr/bin/perl my $c = "AABBCC"; my $m = "B"; $c =~ s/($m+)/XX/; print "Chain : $1.\n"; print "Final chain : $c.\n"; Le résultat est bien celui que j'attendais : Chain : BB. Final chain : AAXXCC. Lets see now Perl 6. with a simple mach. use v6; my $c = "AABBCC"; my $m = "B"; $c ~~ m:c/($m+)/; say "Chain : $0. Place : ", $/.from; Ici aussi, le résultat est bien celui attendu : Chain : BB. Place : 2 and the perl 5 program translated in Perl 6. use v6; my $c = "AABBCC"; my $m = "B"; $c ~~ s/($m+)/XX/; say "Chain : $0."; say "Final chain : $c."; Oups, result is not really what I was waiting : Chain : Any(). Final chain : AAXXCC. The $0 var is set on a mach operation but not in a substitute. So that its value is "Undef" The problem can be solved using firts a m then a s use v6; my $c = "AABBCC"; my $m = "B"; $c ~~ m:c/($m+)/; $c ~~ s/($m+)/XX/; say "Chain : $0."; say "Final chain : $c."; The rseult is what I was waiting : Chain : BB. Final chain : AAXXCC. Where is the problem ? Is there any solution to set the $0 var in a s operation ? Thanks -- ______________________________________________________________________ \|||/ (o o) +--ooO-( )-Ooo------------------------------------------+ | Christian Aperghis-Tramoni | | | | Case Postale 901 Tel : (33) 04 91 82 92 49 | | 163 Avenue de Luminy SFR : (33) 06 18 93 10 70 | | 13288 Marseille Cedex 09 Fax : (33) 04 91 82 92 75 | | France Mel : ch...@dil.univ-mrs.fr | /) ch...@aperghis.net (\ / ) WEB : http://www.dil.univ-mrs.fr/~chris ( \ ( (+-------------------------------------------------------+) ) ((\ \) / ) / ) (/ //) (\\\ \_/ / \ \_/ ///) \ / \ / ___\___/__________________________________________________\___/________ print join('',map({$i=1-$i;$a=$i?10*$_."\b\b":pack"c",$a+$_+0x16}split (//,"5110789279758710838810587992861093898779948387799310")),"...\n"); _______________________________________________________________________