There are three lines of code I always ask people to gauge their Perl skills. I write them down on a white board and ask what they do.

my $c = 1 unless $c;
to see if they understand Perlish shorthand and
my $foo = @bar; my ($phoo) = @bar;

I ask them the difference, and what would actually be assigned to $foo and $phoo. This tells me if they understand the concept of "context". I also ask about the "my" and what it actually means. This, IMHO, covers most of what makes Perl different from other languages, and seems to weed out the pretenders.

update
Ok, I screwed this up. my first line of code doesn't acutually work. I pulled something out of context that works in my mind but not in practice. That should have been this: $c = 1 unless $c; putting the 'my' on there would actually re-declare the variable and set it to undef if it resolved to 'true'. Of course, with this line of code the variable must be pre-declared (I use this when testing web params - the variable defaults to undef if it wasn't filled in by the user, so I get code like $name = 'unknown' unless $name)

In reply to Re: Have you netted a Perl Monk or Perl Pretender in 5 minutes or less? by benrwebb
in thread Have you netted a Perl Monk or Perl Pretender in 5 minutes or less? by Anonymous Monk

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.