There's a lot of good advice on how to interview here at the Monestary. Just a quick search turns up:
I have, instead, bad advice, more in the vein of How's your Perl? and How's your Perl? (II) The last time I used these questions, I asked a coworker who sat in on the interview about them. He responded by saying that if someone gets them right, you know they know Perl really well. If someone gets them wrong, however, you can't tell whether they know Perl well or not. I agree, so I'm more or less retiring them here.
How are these two different?
$self->foo(); foo($self);
(Assume for this problem that $self is a blessed object of some kind.)
How are these two different?
($x) = foo(); $x = foo();
How are these two different?
for ( @x ) { foo( $_ ) } map { foo( $_ ) } @x;
What does this output?
sub baz { return 11 unless shift } print 'baz(5): ', baz(5), "\n"; print 'baz(0): ', baz(0), "\n";
What does this output?
my $FOO = 'foo'; sub bar { $_[0] = 'bar' } print $FOO, "\n"; print bar( $FOO ), "\n"; print $FOO, "\n";
What does this output?
for my $s ( qw( a b c ) ) { $s =~ s/$/\n/ && print $s }
Yes, I really did ask these questions of a candidate. In my defense, I prefaced my questions by saying that I was not very concerned with whether he got the answers right or not. These questions were meant to be "conversation pieces."
In reply to Evil Interview Questions by kyle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |