Perl批量赋予可执行权限

#!/usr/bin/perl
#use Cwd;
sub RightAll(){
	local($dir) = @_;
	opendir(DIR,"$dir"|| die "can't open $dir");
	local @files =readdir(DIR);
	closedir(DIR);
	for $file (@files){
		next if($file=~m/\.$/ || $file =~m/\.\.$/);
		if ($file =~/\.(sh|pl|bin|run|bundle|rb|py)$/i){
			system "chmod +x \"$dir\/$file\"";
		}
		elsif(-d "$dir/$file"){
			RightAll("$dir/$file" );
		}
	}
}
&RightAll(getcwd);

编程技巧