All pastes #927234 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-04 03:09 UTC
rendered paste body
use strict; use warnings "all";

my @files;
my $count = 0;
opendir(DIR,".");
while(my $target = readdir(DIR)){ push(@files,$target); }
while(my $file = shift(@files)){
        if(-d $file && $file=~/^\./){ next; }
        elsif(-d $file){
                print "checking ./$file\n";
                opendir(SUBDIR,$file);
                while(my $subfile = readdir(SUBDIR)){
                        if($subfile=~/^\./ && -d "$file/$subfile"){ next; }
                        else { push(@files,"$file/$subfile"); }
                }
        } else { $count += `cat $file | wc -l`; }
}
print "$count\n";