rockj@idefix:~$ cat codelines.pl use strict; use warnings "all"; chdir("@ARGV"); 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";