As you get used to Perl programming, I think you will find that (lists) are your friends. Experience will undoubtedly teach you when parentheses can be used only for precedence.

Also, I think that you will find that the specific uses for [brackets] to construct lists are also worth the small inconvenience of not being able to use parentheses without considering whether or not you are emitting a list. You see, square brackets can be used to generate an anonymous list reference, so you can generate a list of lists, or a list within a hash. Very powerful data structures can easily be built in Perl with these constructs. Detailed information about these constructions can be found in the perlref documentation.

Attacking lists may be seen by some as tilting at a sacred part of Perl, so some people might be tempted to downvote your meditation. I would suggest otherwise; your question is valid coming from a new Perl programmer, and should be answered. But I do encourage you to explore the power of lists in Perl, and the ease of creating complex data structures with Perl's current syntax. I think you will end up loving (lists) and their syntax as much as most of the rest of us.

Cheers

In reply to Re: List context, expression precedence, and () by HyperZonk
in thread List context, expression precedence, and () by pmas

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.