FYI

https://docs.perl6.org/language/functions#index-entry-MAIN

On Tue, Mar 14, 2017 at 3:58 PM, ToddAndMargo <toddandma...@zoho.com> wrote:
> Hi All,
>
> I wrote myself a little demonstration program on
> reading elements from the command line.  I thought
> it might be useful to others (DuckDuckGo is a bust
> on Perl 6 and the command line):
>
> -T
>
>
> Perl 6: command line parameters:
>
> <code>
> #!/usr/bin/perl6
>
> if not @*ARGS.elems > 0 { say "command line is empty"; exit 0; }
>
> say "\@\*ARGS has " ~ @*ARGS.elems ~ " elements";
> say "   \@\*ARGS      = <" ~ @*ARGS      ~ ">";
> say "   \@\*ARGS.perl = <" ~ @*ARGS.perl ~ ">\n";
>
> say "say in a loop:";
> for @*ARGS.kv -> $indx, $Arg { say "   \@\*ARGS[$indx] = <$Arg>"; }
> </code>
>
>
> $ ./CommandLineTest.pl6
> command line is empty
>
> $ ./CommandLineTest.pl6 a b c
> @*ARGS has 3 elements
>    @*ARGS      = <a b c>
>    @*ARGS.perl = <["a", "b", "c"]>
>
> say in a loop:
>    @*ARGS[0] = <a>
>    @*ARGS[1] = <b>
>    @*ARGS[2] = <c>
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



-- 
Will "Coke" Coleda

Reply via email to