Mercurial > laserkard
annotate filter.pm @ 101:2bec541ef58f laserkard
made it HTML 4.1 strict
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 27 Jul 2010 08:39:43 -0400 |
parents | 599d0315537d |
children |
rev | line source |
---|---|
rlm@0 | 1 package Filter; |
rlm@0 | 2 use base 'Exporter'; |
rlm@0 | 3 our @EXPORT = ('filter'); |
rlm@0 | 4 |
rlm@0 | 5 |
rlm@0 | 6 sub filter |
rlm@0 | 7 { |
rlm@0 | 8 |
rlm@0 | 9 $ref = shift; |
rlm@0 | 10 @list = @_; |
rlm@0 | 11 my @ret = (); |
rlm@0 | 12 |
rlm@0 | 13 for $element(@list) |
rlm@0 | 14 { |
rlm@0 | 15 if ($ref->($element)) |
rlm@0 | 16 { |
rlm@0 | 17 push @ret, $element; |
rlm@0 | 18 } |
rlm@0 | 19 } |
rlm@0 | 20 |
rlm@0 | 21 return @ret |
rlm@0 | 22 |
rlm@0 | 23 } |
rlm@0 | 24 |
rlm@0 | 25 |
rlm@0 | 26 1; |