:prop("cricket bat") :number<5> and prop => "cricket bat" , number => 5 are equivalent, yes.

> :prop("cricket bat") === prop => "cricket bat" True
But it doesn't work for the alias syntax because that syntax for creating an alias and not the pair constructor. They just look similar.

sub doctor(:$prop($internal) ) { This is incorrect syntax. It should be: sub doctor(:prop(:$internal) ) { Please note the lack of $, which makes it just an alias, not a Pair.

So, regarding mandatory parameters, neither of your examples will work: sub doctor(:$prop($internal)! ) { sub doctor(:$prop!($internal) ) { You need: sub doctor(:prop($internal)! ) { or sub doctor(:$prop(:$internal)! ) {

> But named arguments are by default optional, why not the same trick?

It's all about what looks better. According to TimToady. There's no real answer to this question. In this case he is copying how it works in the Unix command line.

> %%

Means "divisible by". It's true when the left argument is divisible by the right one. False otherwise. sub { $_ % 2 } is the opposite, and is numeric instead of boolean like the other one.

$a %% $b is more like !($a % $b). Note the cast to Boolean and the logical negation.


In reply to Re: (Perl6) Signatures by rafaelschipiura
in thread (Perl6) Signatures by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.