I just tried to use "put" in place of "say", and got the same result.
Thanks. Ziping > On Jun 3, 2018, at 8:44 PM, Brandon Allbery <allber...@gmail.com> wrote: > > "say" uses the .gist method, which quotes the output for readability. You > probably want "put" instead. > > On Sun, Jun 3, 2018 at 8:42 PM Xin Cheng <xinchen...@gmail.com > <mailto:xinchen...@gmail.com>> wrote: > Hi, > > I am trying to make a program to do grep with perl6 regular expression, and I > would like to colorize the matched part to the terminal. So the following is > what I wrote > > sub MAIN(Str $pattern,Str $filename){ > for $filename.IO.lines -> $line { > my Str $temp = $line; > if $temp ~~ s/ (<$pattern>) /\\x1b\[31m$0\\x1b\[0m/ {say $temp}; # if > no <> surrounding $pattern it becomes literal. > } > } > > And I named the program as grep6, and I tried it in zsh as > > > grep6 'M.*N' =grep6 > > And I got, > > sub \x1b[31mMAIN\x1b[0m(Str $pattern,Str $filename){ > > How do I turn the string into color? > > Thanks! > > Xin > > > -- > brandon s allbery kf8nh sine nomine associates > allber...@gmail.com <mailto:allber...@gmail.com> > ballb...@sinenomine.net <mailto:ballb...@sinenomine.net> > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > <http://sinenomine.net/>