perl 遍历目录并且对目录中的文件进行操作
opendir (DIR, $dir) or die "can't open the directory!"; my @dir = readdir DIR; foreach my $file (@dir) { }
对二级目录进行遍历,操作二级目录里的文件
my $rawpath=$ARGV[0]; opendir (DIR,$rawpath) or die "can't open!"; my @file = readdir DIR; foreach my $file (@file){ my $newdir = $rawpath."/".$file; opendir(DIR2,$newdir) or die "can't open $newdir!"; my @file2 = readdir DIR2; foreach my $file2 (@file2){ } }