Mercurial > laserkard
diff filter.pm @ 0:599d0315537d laserkard
[svn r1] initial import
author | rlm |
---|---|
date | Wed, 30 Dec 2009 02:01:25 -0500 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/filter.pm Wed Dec 30 02:01:25 2009 -0500 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