Perl Christmas Quiz

Robin Berjon robin at berjon.com
Fri Dec 12 14:24:13 GMT 2008


On Dec 12, 2008, at 13:56 , Paul Makepeace wrote:
> On Fri, Dec 12, 2008 at 12:43 PM, Fahad Khan  
> <fahad.a.khan at hotmail.com> wrote:
>> In my baby perl.
>>
>> sub intersect
>> {
>>   my ($a, $b) = @_;
>>   my ($c, $d) = ({}, []);
>>   foreach (@$a) { $c->{$_}->[0]++}
>>   foreach (@$b) { $c->{$_}->[1]++}
>>   while( my ($k, $v) = each %$c ) {
>>       my ($i, $j) = @$v;
>>       for(my $x=0; $x < ($i < $j ? $i : $j); $x++) {push @$d, $k}
>>   }
>>   return $d;
>> }
>
> Do not apply for a job with that code :-)

Not that I'm hiring or that I can't see issues with the code above,  
but the guy did state he had "baby perl" and then posted his proposed  
solution to a list famous for being full of Perl luminaries.  
Curiosity, guts, willingness to learn — that's a CV I'd look at.

-- 
Robin Berjon - http://berjon.com/
     Feel like hiring me? Go to http://robineko.com/








More information about the london.pm mailing list