yuyongpeng
一个关于删除文件的问题?
my $dir = "d:/testperl";
chdir $dir;
my @allFiles = glob "*.txt";
print @allFiles;
foreach my $files (@allFiles){
chomp $files;
print $dir."/".$files;
unlink $dir."/".$files;
}
上面的删除不成功:
错信息:Insecure dependency in unlink while running with -T switch at D:/Eclipse Program/testperl/test.pl line 14.
my $testa = "d:/testperl/ddd.txt";
chomp $testa;
unlink $testa;
这个语句可以删除。
这是为什么?谁帮我看看,上面的代码是不是有错误。
apile
eclipse帮你打开了..检查看看eclipse的设定
不然你就要修改下面这两行...
my @allFiles = glob "*.txt";
print @allFiles;
成
my @files=();
for my $file (@allFiles){
$file =~/(.*)/;
push(@files,$1);
}
然後用@files去做事情...
[[i] 本帖最后由 apile 于 2008-6-20 13:30 编辑 [/i]]