Mercurial > boosterpack
view filter.pl @ 6:4246c7ef6487 boosterpack
[svn r8] bug fix -- holos need to be one int three compared to rares
author | robert |
---|---|
date | Tue, 08 Sep 2009 17:20:52 -0400 |
parents | d7dd496a4fa6 |
children | 8c6d2ce90677 |
line wrap: on
line source
1 sub filter2 {4 $ref = shift;5 @list = @_;6 my @ret = ();8 for $element(@list)9 {10 if ($ref->($element))11 {12 push @ret, $element;13 }14 }16 return @ret18 }23 @test = (1,2,3,4,5,6);25 sub even26 {27 return ($_[0]%2 == 0);28 }30 @rr = &filter(\&even, @test);32 print "@rr";