In the past few weeks, thanks to the wonderful Monks, I've discovered at least two examples where Perl parsing seems to be inconsistent for the sake of convenience:

Convenience has been an important part of design of Perl from what I understand. Default variables abound. Typing is implicit. Context affects parsing. There is usually more than one way to do things. But generally, it seems, there is order in the chaos. There are, for example, clear rules for determining when something is list or scalar context and mechanisms for forcing a context if you wish. The same goes for implicit typing. Even the flexibility is consistent.

Arguably, even the two examples above are "consistent". A clearly defined contextual rule exists to predict the behavior of $ and while(...). But in another sense, they are not. The context itself, however clearly defined, is a very narrow context, amounting to a special case.

Inconsistencies are not necessarily bad for a language. Natural language abounds in them, and one of the things I have always admired in Perl is the way it tries to emulate the convenience and flexibility of natural language. And yet they also pose problems for teaching. Languages, even natural languages, that contain lots of special case constructions are much harder to learn well than fairly regular languages.

I'm sure the two examples above are old hat to everyone here, but they were new to me. So now I am wondering what other such "inconsistencies for the sake of convenience" exist in Perl? Would the kind monks care to share additional ones that they have come across? And what are your thoughts on the merits or dismerits of "inconsistency for the sake of convenience?"

Best, beth


In reply to Inconsistent for the sake of convenience by ELISHEVA

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.