I’m not 100% positive, and I can’t find it immediately in the documentation, 
but Perl 6 is whitespace sensitive in some situations. In particular, I think 
that it is interpreting the extra space as making the parameter be a list of 
two elements. I know that parenthesis are optional in some situations, which is 
why I’m guessing you’re getting this output…

Ricky

> On Feb 17, 2016, at 11:43 AM, Greg London <[email protected]> wrote:
> 
> 
> Is perl6 whitespace sensitive?
> Or is this a bug?
> 
> I have a multi() for 1 and 2 artuments
> But a 2 arg call ends up getting into the wrong sub
> Apparently because there is a space between the sub name and the
> Opening parenthesis?
> 
> 
> 
> multi mysub($arg1) {
>                say "mysub(one): $arg1";
> }
> 
> multi mysub($arg1, $arg2) {
>                say "mysub(two): '$arg1' then '$arg2'";
> }
> 
> 
> 
> mysub(555);
> mysub(123, 456);
> mysub(999);
> mysub (123, 456);  # a space between sub and parenthesis
> 
> output:
> 
> mysub(one): 555
> mysub(two): '123' then '456'
> mysub(one): 999
> mysub(one): 123 456    <== whoops!
> 
> 
> 
> -- 
> 
> _______________________________________________
> Boston-pm mailing list
> [email protected]
> http://mail.pm.org/mailman/listinfo/boston-pm



The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to