How robust is your Perl programming vocabulary? Are you able to write Perl and speak Perl code? Take this quiz and find out!

Below is a list of 10 terms. Some terms are specific to Perl while others have application to programming languages in general. Some are hard, some are easy. The answers appear on the next page (or below) and can be revealed by highlighting the colored box. No cheating!

pragma
multidimensional hash emulation
zero-width assertion
rvalue
variable interpolation
compound statement
grave accent
range operator
weak reference
funny character

Continue for answers and to see how to score yourself...

pragma: a pragma is a standard module you can call with "use" to change the behavior of your script at compile time. Pragmas are all lowercase to differentiate themselves from other modules.
Example: use strict; use warnings (availabe in version 5.6);
Score: 1 point

multidimensional hash emulation: a very old way creating multidimensional hash. With a hash emulator, a list of keys (rather than just one) is provided in a hash assignment. The keys are then joined with the contents of $; (chr(28) by default) and used as a single key.
Example: $people{ $state, $county } = $census_results
Score: 2 points if you knew they existed OR 3 points if you knew the syntax and how the keys are joined

zero-width assertion: this term is used to describe metacharacters (e.g. ^ and $) and metasymbols (e.g. \b and \B) in regular expressions that represent locations, not characters, within a pattern. In other words, zero-width assertions are zero characters wide.
Score: 2 points

rvalue: an rvalue is what goes on the right side of an assignment operator. There is also an lvalue that goes on the left side of the assignment operator. In the assignment: $x = $y; $y is the rvalue.
Score: 1 point

variable interpolation: the process of evaluating a variable within an expression.
Example: $foo = "bar"; $x = "$foo"; $x now equals "bar" because $foo was interpolated inside the quotes.
Score: 1 point

compound statement: A combination of expressions and blocks where the blocks are exectuted only if the condition of the expression is met.
Example: if (EXPR) BLOCK; unless (EXPR) BLOCK;
Score : 2 points

grave accent: another name for the "backtick" character ('`')
Score : 2 points

range operator: the operator represented by either two or three dots in a row: (..) or (...). See perlop for examples.
Score : 2 points if you knew what it was OR 3 points if you knew it could take 2 or 3 dots.

weak reference: an experimental feature of Perl that does not increase the reference count of an object
Score : 2 points if you heard of it OR 3 points if you knew about the reference count bit.

funny character: Yup, this is a computer science term as coined by Larry Wall in the Camel book. The funny characters are simply the $, @, %, &, and * symbols that precede a symbol table entry. ($foo, @foo, etc.)
Score: 2 points

OK, how did you do? There were 20 points possible.

0-5: A Visual Basic programmer could do better
6-10: Soon you won't need a pacifier
11-15: I bet you studied.
16-19: You're hired!
20: Which O'Reilly book did you write?

DISCLAIMER: The above answers may reflect the stupidity of the author. Any bad code written as a result of above information shall not be the responsibility of said author. Consult perldoc for further guidance.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop";
$nysus = $PM . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
(ichimunki) Re: Perl Programming Vocabulary Quiz
by ichimunki (Priest) on Jul 18, 2001 at 00:36 UTC
    Hmmm. I guess I'd better go back to working with Visual Basic. I think I got 6 after cheating.

    And to think, I'm BrainBench certified in Perl (and have the certificate hanging on my office wall to prove it). :)
Re: Perl Programming Vocabulary Quiz
by jynx (Priest) on Jul 18, 2001 at 03:45 UTC

    well,

    i got an 18, but i only got the grave (not pronounced like what you bury people in!) accent because i've had french class, which is where the symbol matriculated into english; from french, not french class. The other hard one is probably weak references since i've only heard of them because i've read some source code and another interesting document (not that i understood them, but read them nonetheless)

    NOTE: this node meant to help those who didn't immediately get the above have a better idea of what to look for when cheating ;-)

    jynx

Re: Perl Programming Vocabulary Quiz
by pmas (Hermit) on Jul 18, 2001 at 17:41 UTC
    Very good idea, nysus. I liked it.
    We want more stuff like that!

    I also liked how you used highlighting the colored box to hide answers. Can you please post HTML code how you did that - to highligh rest of us? :o)

    pmas

    To make errors is human. But to make million errors per second, you need a computer.

      Sure:

      <table><tr><td bgcolor = 000000><font color=000000> ~~~Contents of table here~~~ </font></td></tr></table>
      This makes a black box with black "invisible" text.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop";
      $nysus = $PM . $MCF;
      Click here if you love Perl Monks

Re: Perl Programming Vocabulary Quiz
by schumi (Hermit) on Jul 19, 2001 at 01:03 UTC
    Ouff! That showed me that I'm really only starting at Perl: 6 points, and only because living in a country with a French-speaking part, I knew the "accent grave" vowels (and some consonants in some languages) can take...

    Great idea, nysus. This is not only fun, but also is a great opportunity to learn. Next time I might do better... ;-)

    --cs