Hi,

If foo() is documented as:
$ret = foo($sclar, [$arrayref], [$hashref]);
then we know that the second and third arguments are optional, and that some default behaviour will be initiated if they are omitted.

Suppose also that you decide to accept the default behaviour re the second arg, providing only a first and third arg ... does the above piece of documentation tell you how to do that ? Do you expect that you will code it as:
1) $ret = foo($scalar, $hashref); or
2) $ret = foo($scalar, undef, $hashref); or
3) $ret = foo($scalar, '', $hashref);
or do you expect that you will have to consult the documentation for further instruction ? Is there a standard for this type of notation ?

Also, if foo() is instead documented as:
$ret = foo($scalar, [$arrayref, [$hashref]]);
that would presumably dictate that if you wish to provide the third argument, then you must also specify a second argument ... right ? Or is this type of notation too loose for drawing any conclusions at all ?

Cheers,
Rob

In reply to Docs notation by syphilis

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.