Don't ask to ask, just ask | |
PerlMonks |
Re: Closures clarificationby moritz (Cardinal) |
on Dec 04, 2007 at 12:46 UTC ( [id://654766]=note: print w/replies, xml ) | Need Help?? |
First of all a closure is a subroutine, and your second example doesn't include one.
Secondly in a closure you have access to a variable in an outer scope, which is "enclosed" in the sub (hence the name), in your first example $total_size.
In Section
Seekers of Perl Wisdom
|
|