I'm doing an exercise with coderefs and wondering if there is much difference between my answer and the one given...
Here is my subroutine that returns two coderefs... sub gather_mtime_between { my ($start, $stop) = @_; my @files = (); return (sub { my $timestamp = (stat $_)[9]; if ( -f and $timestamp >= $start and $timestamp <= $stop) { push @files, $File::Find::name; } }, sub { return @files }); } The answer given is almost identical (but with error checking for the stat call). But it includes variables for the subroutines... sub gather_mtime_between { # etc. my $gatherer = sub { #first coderef variable # sub much the same } my $fetcher = sub { # second # same } } In both cases the sub is called like this: my($gatherer, $yield) = gather_mtime_between($start, $stop); As I understand this, mine returns two anonymous coderefs and the given answer assigns the coderefs to two variables whose contents are then returned (and these two variable names go immediately out of scope)? Is there any reason to use the variables here? And while I'm wasting bandwidth... this subroutine needs to always come first -- or be in a BEGIN block? Thanks all! -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]