hello people, short question: how to use $*ARGFILES in a MAIN function?
context: as an exercice as well as demo, i reimplement unix filters (cat, grep, wc, join, paste, ...). Basic wc could be multi sub MAIN ( :$l ) { say +lines } multi sub MAIN ( :$c ) { say [+] lines>>.chars } multi sub MAIN ( :$w ) { say [+] lines.map: +*.words } now i want grep that can have both -H (head the line with the filename) and the -n (add the number of the line). my 'almost working' attempt was but it takes the flags as signatures. sub MAIN ( Str $pattern, :$H = False , :$n = False , *@rest ) { (IO::ArgFiles.new: @rest).lines>>.say } any help on it? extra note: i use the perl6 shipped with guix so: perl6 -v This is Rakudo version 2019.03.1 built on MoarVM version 2019.03 implementing Perl 6.d. regards marc