Perl Christmas Quiz 2009
Randal L. Schwartz
merlyn at stonehenge.com
Tue Dec 1 16:47:55 GMT 2009
>>>>> "Matt" == Matt Sergeant <msergeant at messagelabs.com> writes:
Matt> On Mon, 30 Nov 2009 18:24:12 +0000, Chris Jack wrote:
>> 1) Without running it to check, what does the following program output?
>>
>>
>> my %a = (3,2,1,0);
>>
>>
>> for my $b (sort values %a) {
>> $b += 4;
>> }
>>
>>
>> print $a{1} . "\n";
Matt> Bizarrely enough, on both my Snow Leopard machines (default perl
Matt> install) this outputs: 4D
Matt> Nice bug there.
Lemme guess. You did this:
$ perl
... type program in here ...
^D (control D)
The "D" is from your control D.
Common misconception.
If that *wasn't* it, let me know, so I can be perplexed. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
More information about the london.pm
mailing list