in reply to Re: Help needed with Perl script designed to find files by extension and count the number of chars
in thread Help needed with Perl script designed to find files by extension and count the number of chars

The memory efficient version

#!/usr/bin/perl -- use strict; use warnings; use File::Find::Rule qw/ find rule /; my $count = 0; my $size = 0; rule( file => name => [ map {"*$_"} @ARGV ], exec => sub { ## my( $shortname, $path, $fullname ) = @_; $size += -s _; ## or use $_ $count++; return !!0; ## means discard filename }, )->in('.');
  • Comment on Re^2: Help needed with Perl script designed to find files by extension and count the number of chars
  • Download Code