Please help me debug this perl script,I reccommend:
[1] use File::Find
[2] visit www.perlmonks.org
[3] ask on #perlhelp on IRC on efnet
good luck
what it does is it searches a directory for files with numbers in them and that have a desired extension, anyway here is the script:
sub listnumfiles { ################################ # listnumfiles is (C) Copyright Charlie Somerville, and no-one else BUT Charlie Somerville # # Use of listnumfiles is described in the GPL Public licence. (check http://awstats.sourceforge.net/docs/awstats_license.html for details) ################################
my $dir,$ext,@dirlist,@retdirlist,$currfile; $dir=$_[0]; $ext=$_[1]; if(! -d $dir) { die "Error 2!\nPlease check the manual for an error description.\n"; } opendir(DIR,$dir) or die "Error 1!\nPlease check the manual for an error description.\n"; @dirlist=<DIR>; $num=0; foreach (@dirlist) { if(-d $currfile) { die "Error 3!\nPlease check the manual for an error description.\n"; } if($currfile=~m/(\w*\d+\w*\.$ext)/) { push @retdirlist,$currfile; } $num++; } @[EMAIL PROTECTED]; }
listnumfiles("C:/projects/test_dir/","txt"); print @listnumfile::FILELIST;
