"Kevin Pfeiffer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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... > <snip /> > > 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?
Both of your examples returned anonymous code refs. Yes, $gatherer and $fetcher from gather_mtime_between() go out of scope when the subroutine returns. The reason for using the variables is to make the sub more readable. Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]