James Freeman said:
> You only have a short time to interview each candidate, and to be
> fair to each applicant you set up five questions to ask each one.  What
> five questions do you ask?

Well, what level of perl expertise are you lookign for?
Here are some basic to intermediate questions.
(nothing web-specific, just perl oddities that most
perl programmers would know. If your applicant doesn't
know these, then you might want to question
their resume that says they have 10 years experience
with perl.

NOTE: I haven't debugged and tested any of these questions.
There may be errors in these questions or the answers.
You should test them yourself before using them in an interview.


1: List all values that perl interprets as false.

2: How would you sort an array by numeric order?

3: What is printed when this script executes?
my %hash;
if($hash->{key1}->{key2})
{print "Exists!";} else {print "Doesnt exist"}
print Dumper \%hash;

4: You need to temporarily change the value of
a package variable for a subroutine that uses
that variable. How would you do it?

5: What is printed when this script executes?
package Dog;
sub Speak { print Dumper [EMAIL PROTECTED]; }
Dog->Speak('woof');

answers:
1: integer 0, float 0.0, strings '0' and '', undef
2: @sorted = sort {$a <=> $b} @array;
3: Doesnt exist { 'key1' => {} }
4: { local($variable)= $tempvalue; SubCall(); }
5: [ 'Dog', 'woof' ]

explanations:
1: ya gotta know your booleans in perl. "0.0" is TRUE.
If they get 0, '', and undef, then they at least know
perl but may never have run into corner cases.

2: perl only sorts alphabetically by default.
You have have to know how to put in your own routine
to sort numerically. If they've done much coding in perl,
they must have run into this at some point.

3: trick question. the point isn't Exist or not,
the point is whetehr the applicant knows about
perl's nasty habit to autovivify on a multi-level key lookup.
'key1' was added to the hash with an array ref as its data,
even though the hash started out empty.

4: if they don't know "local", then they haven't done much perl.
using local saves the old value, puts in the temporary value,
and the returns the old value at the end of the lexical scope,
all automatically. If they do it manually, they don't know a
lot of perl. i.e.

my $temp = $globalvariable;
$globalvariable = $newvalue;
SubCall();
$globalvariable=$temp;

5:Another trick question. The important bit isn't "woof",
the important bit is that they know "Dog" comes out too.

All the arguments in a method call are in the @_ array,
but the invocant is pushed into the bottom of the array.
This is totally weird when compared to any other language,
but completely normal inside perl. If the applicant doesn't
know how invocants are passed into a method call by pushing
them onto the @_ array, then they don't know Object Oriented Perl.

i.e. if they answer [ 'woof' ], instead of [ 'Dog', 'woof' ]
then you might end up having to teach them object oriented perl.


Greg

 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to