Mercurial > rlmcintyre
comparison BoosterPack/.svn/text-base/filter.pm.svn-base @ 0:0d795f02a8bb tip
initial committ. what was I thinking?
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 27 Sep 2010 16:57:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0d795f02a8bb |
---|---|
1 package Filter; | |
2 use base 'Exporter'; | |
3 our @EXPORT = ('filter'); | |
4 | |
5 | |
6 sub filter | |
7 { | |
8 | |
9 $ref = shift; | |
10 @list = @_; | |
11 my @ret = (); | |
12 | |
13 for $element(@list) | |
14 { | |
15 if ($ref->($element)) | |
16 { | |
17 push @ret, $element; | |
18 } | |
19 } | |
20 | |
21 return @ret | |
22 | |
23 } | |
24 | |
25 | |
26 1; |