rlm@8: #!/usr/bin/perl rlm@8: rlm@8: package Filter; rlm@8: use base 'Exporter'; rlm@8: our @EXPORT = ('filter'); rlm@8: rlm@8: rlm@8: sub filter rlm@8: { rlm@8: rlm@8: $ref = shift; rlm@8: @list = @_; rlm@8: my @ret = (); rlm@8: rlm@8: for $element(@list) rlm@8: { rlm@8: if ($ref->($element)) rlm@8: { rlm@8: push @ret, $element; rlm@8: } rlm@8: } rlm@8: rlm@8: return @ret rlm@8: rlm@8: } rlm@8: rlm@8: rlm@8: 1;