Perl Christmas Quiz

Joel Bernstein joel at fysh.org
Fri Dec 12 11:37:23 GMT 2008


2008/12/12 Chris Jack <chris_jack at msn.com>:
> 2) Name all the built in file handles in Perl.

STD(IN|OUT|ERR)
ARGV ARGVOUT
DATA

> 3) Write a Perl function that takes two references to arrays and returns the intersect of them. If an entry appears n times in array 1 and m times in array 2, the output should list that entry min(n,m) times. Bonus mark for one line solutions.

use Set::Scalar;
sub intersect (\@\@) {
  my ($a1, $a2) = map { Set::Scalar->new(@$_) } @_;
  my $intersection = $a1 * $a2;
  return $intersection->elements;
}

Surely you didn't want a wheel-reinvention answer? ;-)

> 4) How many different variable types are there in Perl? Be as sensibly voluminous in your answer as you are able.

SCALAR ARRAY HASH CODE
FileHandle DirHandle Regexp

But clearly we distinguish between numeric and string scalar values,
so I'm wondering how exhaustive that list is...


> 5) What animal is on the front of the Perl Cookbook (bonus mark for knowing both the first and second edition)?

A horned sheep of some kind. Don't think I've ever seen the first ed though...

> 7) What does the L in Randal L Schwartz stand for?

Loser.

> 8) Name a Perl module Leon (Brocard) has written (bonus mark if you've used it).

Devel::ebug

> 9) When will Perl 6 be released?

Never.

Bored now.

/joel


More information about the london.pm mailing list