I'm wondering which colons are associated with method and function calls in Perl 6. For the record, I use the version of perl6 2015.05-55-gd84bbbc built on the version of MoarVM 2015.05.
I just saw the following in the Perl6 Test spec (S32-io) (I added a comment):
$fh.print: "0123456789A";
As far as I can tell, this is equivalent to:
$fh.print("0123456789A");
Both of them seem to take a few arguments and fine-tune lists:
$fh.print: "012", "345", "6789A";
$fh.print("012", "345", "6789A");
my @a = <012 345 6789A>;
$fh.print(@a);
$fh.print: @a;
There must be some reason to have these two different syntaxes. Is there a reason to use one or the other syntax?
I also noticed that when used as a method, we should use either :or ()with print:
$fh.print(@a);
$fh.print: @a;
$fh.print @a;
print. : () :
print @a;
print(@a);
print: @a;
print @a, @a;
print: @a, @a;
script. :
print @a;
:
print: @a, @a;
:
$fh.print: @a, @a;
, , . - . , - ?