Created
April 21, 2016 10:51
-
-
Save tadzik/876ad5e3e01819f08e1cb724b7de3d8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌─[tadzik@yavin]─[~/.rakudobrew/moar-nom] (remotes/origin/HEAD)* | |
└─[%]─> perl6 test.pl --named1 positional1 --named2 positional2 --named3 | |
["positional1", "--named2", "positional2", "--named3"] | |
{:named1} | |
┌─[tadzik@yavin]─[~/.rakudobrew/moar-nom] (remotes/origin/HEAD)* | |
└─[%]─> g diff src/core/Main.pm | |
diff --git a/src/core/Main.pm b/src/core/Main.pm | |
index cbbd835..4c7a066 100644 | |
--- a/src/core/Main.pm | |
+++ b/src/core/Main.pm | |
@@ -32,9 +32,8 @@ my sub MAIN_HELPER($retval = 0) { | |
%named-arguments.push: $arg => !$negate; | |
} | |
} else { | |
- @args.unshift($passed-value) unless $passed-value eq '--'; | |
- @positional-arguments.append: @args.map: &val; | |
- last; | |
+ last if $passed-value eq '--'; | |
+ @positional-arguments.push: $passed-value; | |
} | |
} | |
@positional-arguments, %named-arguments; | |
┌─[tadzik@yavin]─[~/.rakudobrew/moar-nom] (remotes/origin/HEAD)* | |
└─[%]─> ./perl6 test.pl --named1 positional1 --named2 positional2 --named3 | |
["positional1", "positional2"] | |
{:named1, :named2, :named3} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment