sub open_directory {
my $directory = shift @_;
my @files = ();
opendir (my $dh, $directory) or die "Couldn't open dir '$directory' : $!";
my @all_files = readdir $dh;
closedir $dh;
foreach my $files(@all_files){
while($files =~ /\.htm/){
push(@files);
}
}
return @files;
}
错误在于代码push(@files);
错误是:
Useless use of push with no values
我想使用正则表达式处理名称结尾的文件.htm
或数组.html
中的文件,请帮助我。@files
/\.htm/