view 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
line wrap: on
line source
1 #!/usr/bin/perl
3 package Filter;
4 use base 'Exporter';
5 our @EXPORT = ('filter');
8 sub filter
9 {
11 $ref = shift;
12 @list = @_;
13 my @ret = ();
15 for $element(@list)
16 {
17 if ($ref->($element))
18 {
19 push @ret, $element;
20 }
21 }
23 return @ret
25 }
28 1;