Mercurial > boosterpack
diff filter.pm @ 2:d7dd496a4fa6 boosterpack
[svn r4] actual functionality!
author | robert |
---|---|
date | Tue, 08 Sep 2009 02:45:26 -0400 |
parents | |
children | 8c6d2ce90677 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/filter.pm Tue Sep 08 02:45:26 2009 -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