There are thirteen exercises this year. Each exercise consists of a predicate to be made true by a short snippet of code preceding the test. (For example, a simple way of checking your solution for an exercise is: perl -e '<solution>; <exercise> and print "ok!\n"')
- Don't reuse the method of solution of one exercise for any other.
- Don't make use of any external files (including modules).
- No tie() and no bless().
All exercises have been tested with perl 5.8.*, and solutions do not necessarily have to work with any other version. Don't hesitate to use deprecated or experimental features, or depend on implementation details or even bugs, but avoid platform dependencies.
When posting comments, please protect spoilers and solutions from accidental viewing, for example using a black-box (<table bgcolor="#000000"><tr><td><font color="#000000">Text goes here</font></table>)
Have fun!
(not in order of difficulty)
Exercise 6 Update: \$foo[0] == \$foo[1] && !$[Exercise 1: \$foo =~ /^[A-G]/ Exercise 2: \$foo =~ /^[H-N]/ Exercise 3: \$foo =~ /^\0/ Exercise 4: \$foo =~ /IO::Handle/ Exercise 5: \$foo =~ /IO::/ && $foo Exercise 6: \$foo[$[] == \$foo[$[+1]
Exercise 7: !eval { ($foo) = $foo } Exercise 8: !eval { [ @foo ] } Exercise 9: $foo && $foo =~ /^0\z/ Exercise 10: $foo =~ /^0\z/ && $foo Exercise 11: "$|" == 2 && $| == 0 Exercise 12: ($| = 1) == 2 Exercise 13: undef
Special thanks to mauke and woggle.
UPDATE: Apparently the notion of taking advantage of a yet-to-be-fixed bug is controversial. I therefore note that only 8, 11, and 12 are fishy in this regard, the other exercises are definitely solvable without exploiting bugs.
UPDATE: Minor rephrase of instructions for clarity.
UPDATE: Cool! ambrus and wog found an innovative way of solving 8 without exploiting a bug! :-D
UPDATE: Official solutions will be posted on monday. Until then there are hints below.
UPDATE: Official solutions have been posted.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How's your Perl? (II)
by tilly (Archbishop) on Jul 21, 2004 at 22:59 UTC | |
by FoxtrotUniform (Prior) on Jul 21, 2004 at 23:27 UTC | |
by tilly (Archbishop) on Jul 22, 2004 at 00:38 UTC | |
by wolfger (Deacon) on Jul 22, 2004 at 15:11 UTC | |
by tilly (Archbishop) on Jul 22, 2004 at 16:15 UTC | |
Re: How's your Perl? (II)
by ccn (Vicar) on Jul 21, 2004 at 21:42 UTC | |
by xmath (Hermit) on Jul 21, 2004 at 21:44 UTC | |
Re: How's your Perl? (II)
by BrowserUk (Patriarch) on Jul 22, 2004 at 04:14 UTC | |
Re: How's your Perl? (II)
by itub (Priest) on Jul 22, 2004 at 00:32 UTC | |
Re: How's your Perl? (II)
by Errto (Vicar) on Jul 22, 2004 at 03:59 UTC | |
by eric256 (Parson) on Jul 22, 2004 at 04:07 UTC | |
by Errto (Vicar) on Jul 22, 2004 at 04:30 UTC | |
by mauke (Novice) on Jul 22, 2004 at 06:26 UTC | |
by xmath (Hermit) on Jul 22, 2004 at 09:00 UTC | |
by Errto (Vicar) on Jul 22, 2004 at 13:20 UTC | |
Re: How's your Perl? (II)
by ambrus (Abbot) on Jul 22, 2004 at 13:55 UTC | |
by wog (Curate) on Jul 22, 2004 at 19:37 UTC | |
Re: How's your Perl? (II)
by xmath (Hermit) on Jul 22, 2004 at 14:14 UTC | |
Re: How's your Perl? (II)
by diotalevi (Canon) on Jul 22, 2004 at 17:25 UTC | |
Re: How's your Perl? (II)
by xmath (Hermit) on Jul 26, 2004 at 13:26 UTC | |
Re: How's your Perl? (II)
by roju (Friar) on Jul 22, 2004 at 15:54 UTC |