Mercurial > rlmcintyre
diff 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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/BoosterPack/.svn/text-base/filter.pm.svn-base Mon Sep 27 16:57:26 2010 -0400 1.3 @@ -0,0 +1,26 @@ 1.4 +package Filter; 1.5 +use base 'Exporter'; 1.6 +our @EXPORT = ('filter'); 1.7 + 1.8 + 1.9 +sub filter 1.10 +{ 1.11 + 1.12 + $ref = shift; 1.13 + @list = @_; 1.14 + my @ret = (); 1.15 + 1.16 + for $element(@list) 1.17 + { 1.18 + if ($ref->($element)) 1.19 + { 1.20 + push @ret, $element; 1.21 + } 1.22 + } 1.23 + 1.24 + return @ret 1.25 + 1.26 +} 1.27 + 1.28 + 1.29 +1; 1.30 \ No newline at end of file