annotate Filter.pm @ 10:3b52ac950753 boosterpack tip

going to try to fix this thing
author Robert McIntyre <rlm@mit.edu>
date Mon, 27 Sep 2010 17:24:06 -0400
parents 8c6d2ce90677
children
rev   line source
rlm@8 1 #!/usr/bin/perl
rlm@8 2
rlm@8 3 package Filter;
rlm@8 4 use base 'Exporter';
rlm@8 5 our @EXPORT = ('filter');
rlm@8 6
rlm@8 7
rlm@8 8 sub filter
rlm@8 9 {
rlm@8 10
rlm@8 11 $ref = shift;
rlm@8 12 @list = @_;
rlm@8 13 my @ret = ();
rlm@8 14
rlm@8 15 for $element(@list)
rlm@8 16 {
rlm@8 17 if ($ref->($element))
rlm@8 18 {
rlm@8 19 push @ret, $element;
rlm@8 20 }
rlm@8 21 }
rlm@8 22
rlm@8 23 return @ret
rlm@8 24
rlm@8 25 }
rlm@8 26
rlm@8 27
rlm@8 28 1;