This "sort of" works, in that it does the right thing when you give one correct arg, and fails when you give neither arg or both args. The error message is good when you give both args, but LTA with no args.
# Require either named arg "need" or named arg "hope", but not both multi sub MAIN (Int :$need) { say "Needed $need" } multi sub MAIN (Str :$hope) { say "Hope for $hope" } -y On Sat, Jun 27, 2015 at 6:39 PM, Tom Browder <tom.brow...@gmail.com> wrote: > I'm trying to take advantage of the MAIN suroutine to handle most all of > my routine command line arg handling. One idiom I use a lot is for the > user to choose only one of two args, but one must be chosen. > > Reading S06, I don't yet see a way to do that without dropping back to > handling the @*ARGV array in the same way I am used to handling the @ARGV > array in Perl 5 (e.g., as each arg 1 or 2 is checked for in @ARGV, check if > the other has been entered already and inform the user accordingly; then, > after @ARGV is read, ensure one of the required args was found). > > Am I wrong? > > Thanks. > > Best regards, > > -Tom >