explain code section please...



Hello All,

Can someone please explain this code section to me. This is from the
O'reilly book. learning objects,references. I see the end result, but i
am not sure how and in what order it runs. I see that the $callback
variable is a reference to the subroutine,
'create_find_callback_that_sums_the_size' then the find method is
called with the $callback reference and the bin directory. Then the
subroutine executes on each of the contents of the bin directory. Is
that right so far ?? Thanks...

use File::Find;

sub create_find_callback_that_sums_the_size {
my $total_size = 0;

return sub {
if (@_) {
return $total_size;
} else {
$total_size += -s if -f;
}
};

}

my $callback = create_find_callback_that_sums_the_size( );
find($callback, "bin");
my $total_size = $callback->("dummy");
print "total size of bin is $total_size\n";

.