> On 30/06/2023 06:06, ToddAndMargo via perl6-users wrote:
>> if @*ARGS.elems > 0  &&  "@*ARGS[0]".lc eq "debug"  {...}

On 6/30/23 02:40, Richard Hainsworth wrote:
I tried this and it worked without any problem.

And today is is working for me as well without
a problem. I must have had something else wrong
taht I did not recognize.  So false alarm.


Here's the whole program:

use v6.d;
say @*ARGS.raku;
if @*ARGS.elems > 0 && "@*ARGS[0]".lc eq "debug" {
     say 'got' }
and at the terminal:

$ raku todd-test.raku debug --debug=50
["debug", "--debug=50"]
got


FWIW
why are you quoting ARGS? The .lc coerces to string anyway.

It is a habit from programming in bash.  I did not even
realize I had done it.  And I dp prefer Raku's
way of doing it.

why are you using && and not 'and'

See Yary's response.

why are you not using a sub MAIN with an optional --debug
eg. sub MAIN( @args, Bool :$debug=False) {
#stuff
if $debug { ... }

Because it is less complicated for what I am doing.

Thank you for the help!

-T

Reply via email to