Richard Lee wrote:
trying to understand closure
perldoc -q closure
and callback(bit over my head but)
while I think i grasp most of the ideas from below program.. I don't
think I understand why ( ) is needed in
my $sum = $subs{$_}{GETTER}->( );
#!/usr/bin/perl
use warnings;
use strict;
use File::Find;
sub create_find_callbacks_that_sum_the_size {
my $total_size = 0;
return(sub { $total_size += -s if -f }, sub { return $total_size } );
You don't need to stat() the same file twice:
return(sub { $total_size += -s _ if -f }, sub { return $total_size
} );
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/