### Comment on

 Need Help??

Perhaps a small seemingly off topic diversion might make my point clearer. Consider the beginning of Louis Carroll's "The Jabberwocky":

```Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.
```

Even though almost none of the words will ever be found in the dictionary, my guess is that you know that "brillig" is an adjective, "toves" are some sort of animal or animate being, and "outgrabe" is a verb. You know all this because as a skilled English speaker your brain can use the structure of the sentence and the morphology of a word to guess its approximate meaning.

In the same way, an experienced programmer who has never read Perl before in their life might well guess that at the meaning of \$#foo when he or she sees for (0..\$#foo). He or she knows that "for" clauses generally have starting and ending boundary conditions. 0 looks like a starting condition. ".." is a common symbol for a series in both mathematics and English. By process of elimination \$#foo is likely to be the final boundary condition.

However the ability to guess at the meaning is not quite the same thing as \$#foo having inherent meaning on its own. Were one to encounter my \$x=\$#foo one would be lacking the structural hints and \$#foo would be opaque in meaning if you didn't have prior knowledge. The # suggests it might have something to do with numbers, but there is nothing that says what number it refers to: first index, last index, count, or something else entirely? You'd have to look it up.

That same programming background can also trip people up if they assume too much. !@somearray only makes sense once you've got the notion of context determining data type. For someone coming from a computer language where that doesn't exist as a concept !@somearray just looks like nonsense or an always false statement. Negating an array makes no sense at all to someone coming from a VB background. For someone coming from C/C++ or Java, it would likely be interpreted as always false. @somearray is an array rather than a reference so presumably it "exists", i.e. already has an address reserved. If it has an address, how can it be "not" even if the array itself is completely empty? Zero-length is not the same as non-existent or null. Even if you argue that every piece of that chain of logic is completely wrong in Perl or even in C, you are only driving the point home further: for !@somearray to make sense you first have to think in a Perlish way. If you don't you are left confused trying to shoehorn it (unsuccessfully) into the concepts of other languages.

On the other hand, once you do understand Perl, the language holds together well and has good mnemonics. The "#" in \$# is a good mnemonic for that "number thing" associated with an array, but it only helps once you already know the meaning and just need a little memory jog.

In reply to Re^3: What's it with Perl Syntax ?! by ELISHEVA
in thread What's it with Perl Syntax ?! by biohisham

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.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, 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: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
 [choroba]: Syntax::Construct version 1.005 released to CPAN. The main change: 5.28 support.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2018-06-25 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should cpanminus be part of the standard Perl release?

Results (126 votes). Check out past polls.

Notices?