Re: How do I test my substitutions?

2018-08-14 Thread ToddAndMargo
On 08/14/2018 06:33 PM, yary wrote: "so" coerces to True or False. "say /c/" would output the match object "say so /c/" says True. Depends on what you want to see. " $x ?? $y !! $z" is a shortcut - "if $x use value of $y else use value of $z" and ought to be used for the final value. You may

Re: How do I test my substitutions?

2018-08-14 Thread yary
"so" coerces to True or False. "say /c/" would output the match object "say so /c/" says True. Depends on what you want to see. " $x ?? $y !! $z" is a shortcut - "if $x use value of $y else use value of $z" and ought to be used for the final value. You may know it in perl5 as "$result = $x ? $y :

Re: How do I test my substitutions?

2018-08-14 Thread ToddAndMargo
On 08/14/2018 08:29 AM, yary wrote: Or, store the string in $_, and take advantage of less to type- perl6 -e '$_="abc"; say so /z/; say so /b/; s/c/defg/ ?? .say !! say "Failed!"' -y Thank you! Well I can see it working, but what does "so" "??" ".say" "!!" do? My actual

Re: How do I test my substitutions?

2018-08-14 Thread yary
Or, store the string in $_, and take advantage of less to type- perl6 -e '$_="abc"; say so /z/; say so /b/; s/c/defg/ ?? .say !! say "Failed!"' -y On Tue, Aug 14, 2018 at 4:17 AM, ToddAndMargo wrote: > > On 14/08/18 13:08, ToddAndMargo wrote: > >> Hi All, > >> > >> The Perl 5 guys have it

Re: How do I test my substitutions?

2018-08-14 Thread ToddAndMargo
> On 14/08/18 13:08, ToddAndMargo wrote: >> Hi All, >> >> The Perl 5 guys have it pounded into my head that I >> always had to check my substitutions to see if they >> worked if not working would crash the program. >> >> So in Perl 6 I have: >> >> $ p6 'my $x="abc"; if s/b/z/ {say "sub

Re: How do I test my substitutions?

2018-08-14 Thread Timo Paulssen
You're putting your starting string in a variable, $x, but aren't telling the s/// operator specifically what to operate on, so it defaults to $_, which is still at its default value. On 14/08/18 13:08, ToddAndMargo wrote: > Hi All, > > The Perl 5 guys have it pounded into my head that I >