On Feb 1, Robin Sheat said:

>On Fri, Jan 30, 2004 at 10:33:27AM -0500, Jeff 'japhy' Pinyan wrote:
>>   sub array_diff {
>>     my ($first, $second) = @_;
>>     my %diff = map { "@$_" => 1 } @$second;
>>     return [ map !$diff{"@$_"}, @$first ];
>>   }
>amended to:
>    return [ grep !$diff{"@$_"}, @$first ];
>(for the benefit of anyone else looking at this), and it works a charm
>(with the really minor exception of being an array too deep, but that is
>easy fixed.)

Thanks for that fix.  I wrote 'map' once, I wrote it twice.  Silly
mistake.

As far as it being an array too deep, I did that because it takes two
array refs of array refs as arguments, so I made it return an array ref of
array refs.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to