Christmas quiz 2010
Chris Jack
chris_jack at msn.com
Tue Dec 21 18:14:10 GMT 2010
Well the quiz obviously went down as well as the proverbial lead balloon, but I thought I should publish some answers anyway. Apologies for the loss of formatting in the perl code - it's formatted when I sent it. Oh and merry xmas: http://www.youtube.com/watch?v=-QGCrIY1HME
questions based on http://www.onyxneon.com/books/modern_perl/modern_perl_a4.pdf
1) What does "Tim Toady" refer to?
It's the pronounciation of the acronym: there's more than one way to do it
2) What does this output?
for (qw( Huex Dewex Louid )) {
$_++;
print;
}
---
Doesn't compile as attempting to alter a constant
3) What year was Perl first released in?
1988
4) If the following was a complete perl program, would it initialise %hohoho.
What statements could you add to verify this?
my %hohoho;
if ($hohoho{Robot}{Santa}{Claus} eq "sleigh") {
print "Coming to town\n";
}
---
%hohoho gets initialised.
my %hohoho;
print scalar(%hohoho) ."\n";
if ($hohoho{Robot}{Santa}{Claus} eq "sleigh") {
print "Coming to town\n";
}
print scalar(%hohoho) ."\n";
5) What version of Perl 5 introduced the given/when constructs?
5.10
6) What does the following output?
print scalar((a,b)) . "\n";
---
b
7) What is Perlscript?
http://en.wikipedia.org/wiki/PerlScript
8) What does the following output?
sub parent {
print "Perl 4\n";
&child;
print "Perl 5\n";
child;
}
sub child {
my(@a) = (@_);
for my $i (@a) {
print "$i\n";
}
}
parent(1,2);
---
Perl 4
1
2
Perl 5
9) In December, what will the localtime function report the month as?
11
10) Think of a witty and/or interesting Perl Christmas quiz question and
answer it.
More information about the london.pm
mailing list