How to pass an arbitrary list of arguments on the command line in Perl 6?

I know how to pass single and named arguments on the command line to a Perl 6 script, but how do I pass an arbitrary list of arguments?

For example,

script.pl6 fileA.txt fileB.txt 

and then run it with

 script.pl6 fileC.txt fileD.txt .. fileZ.txt 
+7
perl6
source share
1 answer

Raw command line arguments can be found in @*ARGS .

You can also use sub &MAIN with the slurpy parameter, i.e.

 sub MAIN(*@args) { ... } 

Note that this will reject the calls that the flags pass. If you want to capture them, use

 sub MAIN(*@args, *%flags) { ... } 
+9
source share

All Articles