On 05/23/2014 09:08 PM, Peter Schwenn wrote: > Timo, perl6-users, > > I don't want to print out the WHOLE text resulting from the match (in > my case a long file,) but just the /replacement/ string. > > [...] > > Peter Schwenn > > On Thu, May 22, 2014 at 9:58 PM, <perl6-us...@perl.org > <mailto:perl6-us...@perl.org>> wrote: > > [...] >> perl6-m -e 'my $text = "Well, hello!"; $text ~~ s[ <alpha>+(\W) ] = >> my $res = "Rhino$0"; say (:$res); say (:$text)' >>"res" => "Rhino," >> "text" => "Rhino, hello!" >> >> Hope to help! - Timo
Peter, I think you may have missed the trick I put into that piece of code where I assign to my $res first and chain-assign that into the s[ ... ] operation. This way, you get only the part that has been replaced (in the $res variable in this case). Hope to help - Timo
signature.asc
Description: OpenPGP digital signature