in reply to Re: Perl project lines of code "analyzer"
in thread Perl project lines of code "analyzer"

Updated to:
$ext and push @files, $File::Find::name if $ext eq $_;
Thanks for the tip! Working mostly on windows, i often forget that files may not have a type extension in other systems. Regards.

Replies are listed 'Best First'.
Re^3: Perl project lines of code "analyzer"
by Frandajo (Novice) on Dec 07, 2007 at 00:40 UTC

    Where you have...

    my $fname = $_; if (-f $fname) { foreach my $type (qw(pl pm)) { my (undef, $ext) = split (/\./, $fname); if (defined($ext) && $ext eq $type) { push(@files, $File::Find::name); } } }

    It would be better to instead have...

    my $fname = $_; if (-f $fname && /\.p(l|m)$/) { push(@files, $File::Find::name); }

    ...or so I believe. The reason I changed my own copy to this is that I have scripts with the version number at the end like so...

    Frans_Perl_Program.1.5.1.pl

    ...when I am working on something by stages.