John Orwant
At O'Reilly's 1999 Open Source conference, I emceed and judged the Second Perl Quiz show, which pitted teams of Perl hackers against on another for enduring frame and a motley collection of prizes. Here are the questions, including a few that I didn't ask.
Four teams played, with all participants winning one of the following:
VA Linux: A cube fridge and $40 to fill it with junk food
perltoys.com: Magnetic Perl Poetry Kits
Geek Cruises: 50% off a state room for the Perl Whirl Alaska Tour
O'Reilly & Associates $50 and $25 gift certificates
TPJ: Free two-year subscriptions
The winning team was London.pm, consisting of Richard Clamp, Peter Haworth, Nick-Ing Simmons, and Andy Wardley.
Sample Questions
The Perl Quiz Show isn't like Jeopardy or Wind Ben Stein's Money. It's modeled after College Bowl, a family of collegiate tournaments that I participated in at MIT. I was never very good, so I was eventually promoted int management --I started judging the contests instead of playing in them.
There are two types of questions in College Bowl and the Perl Quiz Show: toss-ups and bonuses. Individuals answer toss-ups; the whole team answers bonus questions. When a player buzzes in and correctly answers a toss-up, his team earns ten points. More importantly, his team earns the right to answer a bonus question worth 20,25, or 30 points. Here's the sample toss-up used to warm up the teams.
TO. This company started in a barn in Newton, Massachusetts,
This question was read slowly to indicate how the best toss-up questions are written: with the most obscure information at the beginning
and originally specialized in technical writing consulting.
At this point, a few people in the crowd already knew the answer.
Their consulting business slowed down in 1985, so they tried publishing some of their material as books, and thought they might give them away to promote their consulting business.
Most people had a good guess in mind after this question
In 1988, they were mobbed by participants at the MIT X Conference for their Xlib manuals, and soon after they focused on publishing computer books.
Now just about everyone knew
They now publish more than 120 books, many of which have pictures of animals on the cover.
If you haven't buzzed in by now, you shouldn't be playing.
They've recently branched out int the conference business.
And the kilowatt spotlight over the head:
For ten points, name this company that is hosting the conference YOU'RE AT RIGHT NOW.
Because many toss-ups are designed so with a giveaway at the end, the questions aren't as challenging in print as they are when spoken. Remember that when you read these questions: the skill is no in answering the question correctly so much as answering it before the other team.
Answer: O'REILLY & Associates
The capitalization indicates the essential part of the answer that players had to utter. Here, anyone who buzzed in only had to say "O'Reilly"; they didn't have to give the full name of the company.
Now let's look at a bonus question.
BO. Twenty-point bonus. I'll give you four book titles; you tell me whether O'Reilly published the book or not.
Occasionally, a bonus question is linked to the previous toss-up.
a. Using Samba
Answer: YES
That's an easy one
b. The Adventure of Food
Answer: YES
Surprisingly, the team got this one right. Too bad it was only a sample question
c. Danger!
Answer: YES
Sounds like a dime-store detective novel
d. Curious George Learns Assembler
Answer: NO (Also accept UNFORTUNATELY NOT)
TOSS-UPS
The four teams each played a semifinal round: the two winners advanced to the final round. The questions in the final round were slightly harder.
ROUND ONE (SEMIFINAL)
T1. Movies have their Oscars, music has Grammies, and TV has Emmys. This year, the Internet Movie Database(imdb.com) won this award, which is given to web sites.
T2. This hybrid data structure is available in Perl 5.005, allowing you to refer to array elements with names instead of numbers.
T3. This newspaper has many more web visitors than actual paper subscribers, and has run stories entitled "Bill Gates Grants Self 18 Dexterity, 20 Charisma", "Chess Supercomputer Beaten Up By More Popular Computer", "Microsoft Patents Ones, Zeros", "Apple Employee Fired For Thinking Different" and "New Smokable Nicotine Sticks," For ten points, what is this newspaper named after a spherical vegetable?
T4. Guess that special variable. What magic scalar can you undefine to make Perl read an entire file directly into a single string?
T5. The baud rate of regular fax machines is a common modem speed, but slow by today's standards. For ten points, name this speed.
T6. There are many sorting algorithms; Perl uses this variety. What is it?
T7. His relevance to Perl is somewhat obscure: the Perl source code is full of Tolkien quotes, and he's directing the Lord of the Rings trilogy, shot on location in New Zealand. Some of his other movies are Bad Taste, Meet the Feebles, and Dead Alive.
T8. You can use it with Active Server Pages and the Windows Scripting Host. This package is an ActiveX scripting engine that lets you incorporate Perl into any ActiveX scripting host. For ten points, what is it?
T9. It had both modules and classes back in 1977. Every official module had an identifier: one or two letters followed by a single digit, and a name, such as White Plume Mountain, the Village of Hommlet, and Glacial Rift of the Frost Giant Jarl. Some of the classes were fighter, thief, cleric, and magic-user. For ten points, name this game.
T9-Bonus. Twenty point chaotic evil bonus. D&D set came with five types of dice: 4-sided, 6-sided, 8-sided, 12-sided, and 20-sided. I'll give you a situation, you tell me which type of die is used in it.
a. Determining you character's strength, intelligence, wisdom, dexterity, constitution, and charisma.
b. How many hit points a first-level magic user has.
c. You're hit by lightning and need to make a saving throw.
d. How many hit points a first-level cleric has.
T10. What does this print?
#!/usr/bin/perl
use constant e=> 2, pi => 3;
print e ** pi;
T11. If Larry Wall is the father of Perl, and Perl is the mother of the World Wide Web, and the Internet is the father of the World Wide Web, what relation is Larry to Al Gore?
T12. Perl doesn't have any Year 2000 bugs, but if you rely on storing the Unix time in a 32-bit integer, you'll get bugs in what year?
T13. What will this print? You can provide you answer in exponential notation if you wish.
print (1 << (1 << 5))
T14. A computer utilizing this medium was used to solve the Traveling Salesman Problem in 1995 by executing 100 trillion operations per second, 100 times faster than the fastest supercomputer of the day. This medium let the computer perform 20 quintillion operations for every joule of energy, and was able to store one bit per cubic nanometer, which is one trillion times the storage density of videotape. For ten points, what is this medium, best known for its double helix?
T15. Guess that scalar. This scalar holds the time at which your program began running.
T16. (Tiebreaker; not asked.) Guess that operator: if you stick this operator in between $x and $y, it will set $x to $y unless $x is already true.
ROUND TWO (SEMIFINAL)
T17. This country has the highest number of Internet hosts per capita, and the master site of the CPAN is located there. On a clear day you can see Estonia from its tallest building, which is a mere twelve stories high. Linux started there.
T18. Guess that module. It has Purity, Terse, and Deepcopy methods. It's bundled with Perl, and written by Gurusamy Sarathy. It's most commonly used to pretty print complex data structures with its Dumper method.
T19. The last meeting of this group was in Oslo, and at some of their workshops, they us humming to vote on proposals. Their motto is "Rough consensus and running code", and they're charged with maintaining the RFC Internet standards.
T20. This character can be used as a shorter equivalent of the double colon. For ten points, what is this character, whose string quoting behavior is emulated by the q function?
T21. In 1995, Perl won the Nobel prize in this discipline, in part for discovering the tau lepton in the mid 1970's. For ten points, name this discipline.
T22. What will this print?
my $i; if ($i = 6) { print "success"} else { print "failure" }
T23. You're Gordon Freeman, a scientist in this popular computer game. After an explosion nearly destroys the underground plant you work in, you have to restart various machines and kill various aliens. Your fellow scientists are eager to be rescued by Marines until the Marines start massacring them in an attempt to cover up the aliens' existence. For ten points, what is this game, which has the same name as a term having to do with radioactive decay?
T24. You want Perl to make use of an already existing C library. What utility is commonly used to create a stub interface?
T25. The Netcraft web server survey has been compiled every August since 1995. In this year's survey, these two web servers place first and second in terms of popularity percentages. What are they, in order?
T26. In my opinion, the scariest addition to regular expressions in 5.005 is ? {something}. For ten points, tell me what this does?
T27. For a quick ten points, hit your buzzer now.
T28. New in 5.004, this pragma accounts for the fact that not every language uses a period as a decimal point, and that not ever language has the same letters as English. Its name is related to L10N, which stands for "localization."
T29. "It is dark in here." "The door is closed." "The Diet Coke can is 41 degrees Fahrenheit." So reads the web page for this device hooked up to the Internet. The device itself is at 48 degrees, and its freezer compartment is 12 degrees.
T30. Where is the Internet top level domain .to located?
T31. travesty, server, client, who, findtar, rmfrom, wrapsuid, uudecode,rename. These are all programs in what directory of the Perl distribution?
ROUND THREE (FINAL)
T32. Two words, pronounced the same. One word is a U.S. army rank, the other is the name for the core of an operation system, and is also what you find plenty of on corn on the cob.
T32-Bonus. Twenty point bonus. Microkernels verses monolithic kernels. (Here, I spoke off the cuff about the difference between the two.) I'll give you four operating systems, and you tell me whether it has a monolithic kernel or a microkernel.
a.MS-DOS
b.GNU Hurd
c.Linux
d.NT
T33. Guess that scalar. By default, out-of-memory errors aren't trappable. But they can be if your Perl was compiled with PERL_EMERGENCY_SBRK and you create an emergency memory pool with this scalar, which has a caret followed by the thirteenth letter of the alphabet.
T34. According to searchwords.com, this is the most popular search term. Surprisingly, it's not pornographic, but is instead a popular audio format. For ten points, name this format, whose name is derived from MPEG3.
T35. If you turn on warnings with -w, what error do you get if your Perl statement is a plain string, and you don't do anything with it?
T36. Pencil and paper ready: According to Win Treese's Internet Index, there are 7.6 billion commercial email messages sent every day. If each message were a regular snail mail letter paying U.S. first class rates, tell me how much that would cost per year, within ten percent.
T37. Guess that scalar. You could use it to cope with division by zero errors, because this variable contains the error message from the last eval command. For ten points, name this variable.
T38. US Sen. Jon Kyl introduced a bill known as the Internet________Prohibition Act in 1997. The act makes it a crime to perform this activity online, even though you can do it on Indian reservations and in Nevada. For ten points, what is this activity?
T39. Perl almost always ignores your comments. Name something that you can put in your comments that Perl will pay attention to.
T40. According to the 9/12/97 issue of the Wall Street Journal, this is the number of miles of undersea cable. It's a funny number, because light could travel it in almost exactly on second.
T41. In Unix, Ctrl-Z suspends a process; Ctrl-C interrupts a process. You can keep these from happening in your Perl program with signal handlers. For ten points, give me the signal handler that lets you trap either Ctrl-Z or Ctrl-C.
T42. Pick the most appropriate unit: days, weeks, months, or years: If you have a cable modem that gives you a constant 1.5 megabit downstream rate, how long would it take you to download the Library of Congress, compressed?
T43. Guess that scalar. This scalar is true if you're inside an eval and false otherwise. For ten points, name this serpentine scalar.
T44. Marvin Minsky and Seymour Papert wrote disparaging book about these computational entities and single-handedly quashed neural net research for almost two decades. For ten points, what is the name of this single-layer neural network?
T45. On August 16 they announced plans to provide Virtual Private Network (or VPN) support for their 594 series of network controllers. They specialize in IP connectivity with product lines that include Remote Access Servers and Switches for Ethernet and token ring LAN's, terminal servers and serial connectivity products for UNIX and NT platforms and Network Controllers for IBM AS/400s. They trade on the Toronto Stock Exchange under the symbol PL, and trade on the NASDAQ under the symbol PERL.
T46. What does close do if you don't provide a filehandle to close?
BONUSES
Bonus questions are typically more in-depth, because the entire team gets to confer before giving an answer.
ROUND ONE (SEMIFINAL)
B1. Twenty point bonus. This is the first bonus of the game, so let's have a question about beginnings. What regular expression metacharacter matches the actual beginning of the string? It's not the caret, since that matches the beginning of each line, and in a multiline string it'll match multiple times. The metacharacter I'm looking for matches only the very beginning.
B2. Twenty point bonus. You can specify the background color of a web page with the BGCOLOR attribute of the BODY tag. If you set BGCOLOR to a pound sign followed by six hex digits, the first two indicate the amount of red, the second two indicate the amount of green, and the third two indicate the the amount of blue. For instance, 00FF0 is a saturated green, and FFFFFF is white. For all twenty points, give me a good yellow.
B3. Twenty point bonus. This special variable holds the name of your Perl program. On some operating systems, you can set it, and make your program seem like it's named something else. Give me the short name of the variable, and the long name provided by the English module, for ten points each.
B4. Thirty point bonus. A correctly functioning Perl program ends with the following two lines.
}BEGIN{
@ARGV = <*M*>
These lines are not part of a string. "Here" documents don't come into play, and there are no sneaky eval tricks. There are no funky characters after these two lines, nor is there a __DATA__ or previously. The program has no signal handlers, it does not launch another process, and it doesn't make strange us of symbol tables or otherwise play with itself. The program does not use any module of pragma.
These two lines are executed just fine. If you put a print before or after the @ARGV line, it's executed too.
What's the (simple!) explanation?
B5. There's a freeware porn detector that spiders through the web and saves images if the amount of continuous skin tone over image exceeds this threshold, expressed as a percent. As it turns out, this is the exact same threshold that Perl uses to determine whether a file is binary or text for the -B and _-T flags. If more than this percentage of the characters are "odd characters" (like control characters or characters with the eighth bit set), it's deemed a binary file. For twenty points, name this amount, within ten percentage points.
B6. For ten points each, give me the two reasons why laptop CPU speeds are typically slower than desktop CPU speeds.
B7. Twenty point bonus. Describe what this displays:
print scalar(localtime);
B8. Thirty point bonus. According to the St. Petersburg Times, in what year is the U.S. expected to use the Internet to collect Census data?
B9. Twenty point bonus. Name that command-line switch, for five points each.
a. You'd use this switch to execute a Perl program in a larger message, because it tells the interpreter to skip down until it finds the first list beginning with #! and containing the word perl
b. You'd use this to append a newline automatically to every print statement.
c. You'd use this switch to verify that your Perl program is syntactically correct.
d. You'd use this switch to specify a directory where modules are located.
B10. Twenty point bonus. Netcraft compiles an annual web server survey, and compiles its results by polling every server it can find, worldwide. Within a factor of the two, how many sites was that, for the 1999 survey?
B11. This is a twenty-five point bonus in five parts; as soon as you get one wrong, the question is over. If the derived class Rabbit inherits form the base class Rodent and you invoke Rabbit::Forage, what does Perl do..(this question doesn't work so well in print, since each subquestion gives away the answer to the previous subquestion.)
a. After failing to find it in the Rabbit class?
b. After failing to find it in the Rodent class?
c. After failing to find it in UNIVERSAL?
d. After failing to find a Rabbit::AUTOLOAD?
e. After failing to find a Rodent::AUTOLOAD?
ROUND TWO (SEMIFINAL)
B12. Twenty-five point bonus. I'm going to describe five pairs of built-in Perl functions. The last letters of the first function are the first letters of the second function: you mash them together and give me the combined name. For instance, if I say "the function that adds something to the end of an array" and "the function that adds something to the beginning of an array", you'd say "pushift". The "sh" is shared.
a. The function that removes something form the end of an array, and the function that readies a directory for reading.
b. The function that converts a binary structure into regular Perl variables, and the function that declares a global namespace.
c. The function that displays a formatted record, and the function that reports where a file pointer is.
d. The function that clears all variables beginning with a specified letter, and the function that you'd use to keep your server from hanging onto a port after it's no longer used.
e. Finally, what two single letter built-in functions combine to make a third built-in function.
B13. Twenty-point bonus. Tell me whether these statements about DBI, the Database Interface, are true or false.
a. Both ODBC and DBI provide a generic interface to multiple database engines.
b. DBI supports multi-threading
c. DBI runs on Windows 95
d. You can manipulate Microsoft Access database from DBI.
B14. Twenty-five point bonus. Guess that module. I'll name five modules that might or might not exist on the CPAN; you tell me if they do.
a. Net::Video
b. WWW::Robot
c. Games::WordFind
d. Modem::Dial
e. Tie::BikePower
B15. Thirty point bonus. For ten points, what does this do?
goto (qw(alpha beta gamma))[rand 3];
For the remaining twenty points, we'll use some audience participation. I contend that goto is used far more often than people admit. I'll ask the crowd to applaud if they've used goto in the last month, and then if they've used redo in the last month. For all twenty points, tell me whether the amount of applause will be significantly higher for goto, significantly higher for redo, or about the same.
B16. Thirty points if you get it on the first try, 20 on the second, 10 on the third, and 5 points if you get it on the fourth try. What country has the largest number of top-level domains ending its two-letter country code? Hint: it's not the U.S., since there aren't that many .us domains.
B17. Twenty point bonus. There are four steps to building and installing a CPAN module on a Unix system once you've downloaded and unpacked it. For five points each, what are the four steps? Each step is something you type at the command line.
B18. Twenty point bonus. What CGI environment variable can you use to determine which browser is visiting your pages?
B19. Twenty point bonus. To the nearest ten percent, what proportion of Internet users have English as their primary language, according to a survey by Global Reach?
B20. Twenty point bonus. I'll give you four Perl constructs; you tell me whether they're executed at run-time or compile-time when they appear by themselves in Perl programs.
a. require statements
b. BEGIN blocks
c. use statements
d. srand()
B21. Thirty point bonus. Here's a palindromic program; it reads the same backwards as forwards. What will it display?
print $;,(1 => "able was i ere i saw elba" <= 1),;$ tnirp
B22. Thirty point bonus. Which of these HTTP status constants exist? Tell me yes or no for each.
a. HTTP_NOT_FOUND
b. HTTP_GONE
c. HTTP_PAYMENT_REQUIRED
d. HTTP_TOO_MANY_USERS
e. HTTP_LANGUAGE
Finally for five points, what is the numeric HTTP status code for HTTP_NOT_FOUND?
B23. Twenty point bonus. Name two ways to embed comments in regular expressions, for ten points each.
B24. Twenty point bonus. For five points each, tell me whether the following snippets are legal or illegal.
a. sub _ { print 4 }
b. $$ = 17;
c. if (2 < 3 < 4) { print
d. open (M, "mail president@whitehouse.gov");
print M, "Release Mitnick || die!";
B25. Twenty point bonus. You have a function that accepts either one or two arrays, and you want those arrays to be implicitly passed by reference. That is, if you're passing in @red and @blue, you want the advantages of by reference but you don't want to have to include the backslashes. What prototype should you use?
ROUND THREE (FINAL)
B26. Twenty point bonus. Four languages: ADA, Basic Plus, C, and Fortran. I'll give you four Perl features; you tell me which of the four languages it also appears in.
a. ++ and -
b. **
c. ::
d. ... if
B27. Thirty point bonus. What are the three types of System V IPC structures?
B28. Twenty point bonus. What meaningful difference, if any, is there between how these two function invocations pass arguments to the blork subroutine?
blork();
&blork;
B29. Twenty-five point bonus. I'll give you five built-in Perl functions; you tell me the maximum number of arguments it accepts, for five points each. I'm counting lists and expressions as single arguments, so for instance "push" takes two arguments: an array and a list;
a. open
b. tie
c. substr
d. splice
e. split
B30. Twenty-five point bonus. Perl programmers love their weird symbols. I'll give you four esoteric symbol names; you tell me a more common name for that character. For instance, if I say "ampersand", you'd say "and".
a. Octothorpe
b. Solidus
c. Quadrathorpe
d. Pilcrow
e. Lemniscate
B31. Thirty point bonus. Perl has a somewhat unearned reputation for being hard to read. We all show how clear it can be by writing lucid programs. But we could also show how murky it isn't by comparing it to something worse. There's a language called Befunge that is two-dimensional, with a stack and an instruction pointer that moves character by character through the program. Here's a program that prints "Hello, world."
0".dlrow , olleH">v ,: ^_@
At this point, I explained how Befunge worked. Full details are at https://www.loungelizard.com/pascal/befunge/beffaq/html, but you can get the gist of it from v. In the program above, the characters are processed from left to right until that v is encountered. Then the characters are processed from top to bottom, until _ is encountered. _ is a "horizontal if", which sends control to the right or the left depending on the contents of the stack.
What will this print?
v,< 0"lreP" >^ + + >v" ^,_@ @
B32. Thirty-point bonus. This HTTP header field is used by a browser to avoid downloading a web page that is already in its cache. The web server compares the value of this field to the last time the web page changed, and returns it only if the web page is more recent.
B34. Thirty point bonus. What does this print? I'll give you some extra time.
perl -e "print substr(**.**, 7, 2)"
B35. Twenty-point bonus. XML documents often have associated DTDs, or document type definitions. I'll give you four DTDs, you tell me if they exist in any of the big DTD repositories on the net.
a. Music Markup Language
b. HTML
c. News stories
d. Real estate listings
B36. Thirty point bonus, all or nothing. What does the following print?
perl -wle 'print +(8/2).".".0.0.0'
a) 4
b) 4.
c) 4.0
d) 4.00
e) 4.000
f) 4.0.0.0
B37. Twenty-point bonus. I'm going to give you some Perl features. For five points each, tell me what version of Perl it was added in: 1,2,3,4, or 5.
a. The ability to handle binary data in strings
b. Henry Spencer's regular expression package
c. Support for object oriented programming
d. The ampersand before function names became optional
TOSS-UP ANSWERS
T1. WEBBY. Not one, buttwo respondents held their trophy aloft and declared, in an homage to Jim Cameron, "I'm the king of World...Wide Web!"
T2. PSEUDOHASH
T3. The ONION
T4. $/ or $INPUT_RECORD_SEPARATOR It's a single newline by default. If you set it to the empty string, Perl will read your file in as paragraphs
T5. 9600 baud
T6. QUICKSORT
T7. Peter JACKSON
T8. PERLSCRIPT
T9. DUNGEONS AND DRAGONS. D&D 3 is slated for release in the year 2000
T10. 1.(piis undefined because use constant only accepts a single assignment. If you're bored, try to prove which is greater, e to the pi'th power, or pi to the e'th power, without resorting to a computer or calculator.)
T11. BROTHER IN LAW. Gore once mistakenly claimed to be the father of the internet
T12. 2038
T13. 1 << 5 is 32, so the whole expression is 2 to the 32. Even though you can print 2 ** 32 just fine, when you're bit shifting Perl uses 32 bit integers, so the ones get shifted off the left end into oblivion
T14. DNA. The work was done by Len Adleman, who's the A of RSA
T15. $^T or $BASETIME
T16. ||=
T17. FINLAND or SUOMI. Source: Win Treese's Internet Index.
T18. DATA::DUMPER
T19. IETF or INTERNET ENGINEERING TASK FORCE
T20. APOSTROPHE ('). You can even say use LWP'Simple, but that looks screwy because when Perl 5 introduced use it also introduced the double colon syntax
T21. PHYSICS, won by Martin Perl. The tau lepton is identical to the electron but weighs 3500 times as much and survives less than a trillionth of a second. According to the Standard Model of particle physics, the elementary building blocks of matter appear in families, with two leptons and two quarks in each. The tau lepton is the first-known member of a third family. (The second and third members are the bottom and top quarks.)
T22. SUCCESS. That = should be ==.
T23. HALF-LIFE. Someone about five or six rows back must have been a huge Half-Life fan, because he went absolutely spastic as I read the question.
T24. H2XS. See the perlxstut documentation for more information
T25. APACHE and MICROSOFT. Apache had 55% and Microsoft had 22%. Netscape was third with 7%
T26. It executes CODE or EVALuates code.
T27. Who says Perl programmers don't care about speed
T28. The LOCALE pragma. See the perllocale documentation bundled with Perl
T29. REFRIGERATOR. FAQ: The coke can is colder than the fridge itself because its on the top shelf near the coils. People always assume that fridge temperatures are uniform, but that's never the case. See https://www.hamjudo.com/cgi-bin/refrigerator. Paul Haas also has a hot tub: This device seems to be the only one of it's kind connected to the Internet. Last Thursday, its web page said that it was nice and warm at 101 degrees Fahrenheit, compared to the outside temperature of 67 degrees. The ozone generator was not on, and the backup battery wasn't plugged in.
T30. TONGA
T31. EG or EXEMPLI GRATIA
T32. KERNEL
T32-Bonus. MONO,MICRO,MONO,MICRO
T33. $^M
T34. MP#. "pokeman" was number 6
T35. USELESS USE OF A CONSTANT in void context. Mark-Jason Dominus said: "The numbers 0 and 1 are exempt from this warning. I looked in the source code, and discovered three other exemptions: Strings beginning with 'di','ds', or 'ig' do not trigger this warning." These exceptions were for the benefit of the wrapman program. They allowed you to include documentation in Perl programs (the pod format hadn't been invented yet) and feed the programs either Perl for execution or nroff for documentation.
T36. $915.42 BILLION. (Accept between $823.878 BILLION and $1.006962 TRILLION)
T37. $@ or $EVAL_ERROR
T38. GAMBLING. The Kyl bill also makes it a crime to provide information about how to use the Internet for gambling. The Senate passed it 90-10, and it's now languishing in a House committee. Several members of the US Supreme Court have a regular poker game.
T39. The LINE directive;
# line 300 "camel"
die;
Died at camel line 300
T40. 186,000 (Close is good enough.)
T41. $SIG{TSTP} or $SIG{INT} .
T42. YEARS. (About four of them). The Library of Congress has about 20 terabytes(160 terabits) today.
T43. $^s
T44. PERCEPTRON
T45. PERLE systems, named after CEO Joseph Perle. (Correct spelling not necessary.)
T46. It closes the CURRENTLY SELECTED FILEHANDLE. That's usually STDOUT.
BONUS ANSWERS
B1. /A
B2. FFFF00(or something close to it: FFFF66 looks pretty good too. The red and green values need to be close to each other and nearly maxed out; blue needs to be anywhere from 00 to 88.) I then showed examples of colors with a web browser; but the subtleties of the differences can't be reproduced accurately in print.
B3. $0 and $PROGRAM_NAME
B4. The Perl program used the -n or -p flags. When the documentation says that they wrap a loop around your code, they mean that literally: they provide the opening and closing braces that make this program syntactically correct. I learned this from judging Eugene van der Pijll's entry in the Fourth Obfuscated Perl Contest
B5. 30%(accept from 20% to 40%)
B6. HEAT dissipation and POWER consumption. Boston.pm got both answers correct; impressive for such a poorly-worded question.
B7. The current date and time in English.
B8. 2010 -- check with Lisa Nyman. Lisa Nyman is a frequent Perl conference attendee who hacks Perl for the U.S. Census. As I'd hoped, she was in the audience; I could tell, because she yelled out "WRONG!" AS soon as I read the answer. Turns out that the Census will be accepting some online forms for the 2000 Census as a test. The team answered 2010, so I awarded full credit. If memory serves, the team was all Norwegian, so after posing the question I added that the U.S. census happens every decade on the decade.
B9. -x,-l,-c,-I
B10. 7,078,194. Accept between 3,539,097 and 14,156,388.
B11. the RODENT class, UNIVERSAL::Forage, it uses RABBIT::AUTOLOAD if that exists, it uses RODENT::AUTOLOAD, UNIVERSAL::AUTOLOAD. After that, you could say it looks in $SIG{__DIE__}.
B12. POPENDIR, UNPACKAGE, WRITELL, RESETSOCKOPT, M and Y
B13. TRUE,FALSE,TRUE(there's also a Win32::ODBC module),TRUE(you use the DBD::ODBC module).
B14. NO, YES, YES, NO --although there is a Win32::Serial module, YES Tie::BikePower calculates power output and power consumption for bicycling. You give it things like riding speed, body weight, hill grade, and wind speed, and it shows you your power output and consumption
B15. Jumps to one of the three labels alpha:, beta:, and gamma: at random. FORTRAN also lets you compute gotos.(The applause levels were about the same, if I remember correctly.)
B16. GERMANY. The top four are shown below. There are 9.2 million registered domains, depending on who's paid their Internic fees this week. 5.5 million are .com sites
.de (Germany) 391,113 .uk (United Kingdom) 360,821 .au (Australia) 122,201 .dk (Denmark) 93,181
B17. perl Makefile.PL, make, make test, make install
B18. HTTP_USER_AGENT
B19. SIXTY percent. (Accept between FIFTY and SEVENTY.) European non-English: 25.5% Asian languages 15.5%
B20. RUN, COMPILE, COMPILE, RUN.
B21. 11. $ is chr(28) , => is a comma, a string evaluates to zero in a numeric context, and the next comma is followed by a null argument to print . $ is a no-op, and tnirp is a bareword.
B22. YES, YES (it means that the document has been permanently removed),YES,NO,NO,404.
B23. The /x modifier and (?# comment )
B24. LEGAL, LEGAL but ineffective, ILLEGAL, ILLEGAL. It's illegal to threaten the president, and there's a comma after the filehandle in the print statement. There's also no pipe symbol before "mail", and the @ isn't backslashed. Whoever wrote this should be in prison.
B25. \@; \@ Tom Christiansen pointed out that prototypes should really be called "input context templates", because they're really not like prototypes in other languages.
B26. C, FORTRAN, ADA, BASIC Plus
B27. SEMAPHORES, MESSAGE QUEUES, and SHARED MEMORY.
B28. blork() has no input arguments; &blork ends up with the input arguments from its caller.
B29. 2 (filehandle, expression. You can omit the expression!), 3 (variable, classname, list), 4 (expression, offset, length, replacement), 4 (array, offset, length, list), 3 (pattern, expression, limit).
B30. POUND or HASH or TICTACTOE, SLASH (it's also called a "virgule"), EQUAL sign(because two of them form an octothorpe), PARAGRAPH symbol, INFINITY symbol.
B31. p+e This was inspired by Chris Howe's entry for the Obfuscated Perl Contest, which printed out "The Perl Journal" by creating a Befunge interpreter and running a Befunge program that printed "The Perl Journal" through it. He did this in exactly 1000 characters.
B32. # WHAT DOES THIS PRINT? Seeking the DATA filehandle can take you anywhere in the program. Nathan Torkington pointed out that you can even stat(DATA) to find out when the program was last modified.
B33. IF-MODIFIED-SINCE
B34. **. **.** looks like a shell glob, but it's actually a ** typeglob **is* main::*, so **.** is *main::**main::*, and the ** eighth and ninth characters are "**."
B35. YES, YES, (HTML 4.0), YES, YES
B36. 4.00 The subexpression 0.0.0 is actually the float 0.0 concatenated with 0. But 0.0 is the same as 0, hence we only get 2 0's.
B37. 3,2,5,5. By the way, Perl 5 has now been out longer than all other versions combined.
Thanks to: Tom Christiansen, Chris Nandor, Abigail, Mark-Jason Dominus, Nathan Torkington, and Jarkko Hietaniemi, all of whom provided a few question ideas(sometimes inadvertently).
Jon Orwant is the editor of TPJ, and recently received his PhD from the MIT Media Laboratory for creating a Perl program that itself creates a Perl programs. The generated programs play games with people and predict what they'll do.