Hi,
I experience some issues to list the files with a pattern matching in Perl. I want to exclude the files beginning by "abc" or "ppt" or "jac". But I experience some issues to exclude some files or to list some other files that are not concerned by this exclusion.
I use a pattern like : $sf="abc|ppt|jac";
Have any idea to put a correct pattern?
Thanks a lot.
=======
Here is my script:
opendir(DIRS, "$direc");
@list1 = readdir(DIRS);
closedir(DIRS);
my $sf="abc|ppt|jac";
foreach(@list1){
unless($_ eq '.' || $_ =~ m/^$sf*/){
push(@list2, $_);
}
}
foreach my $file (@list2){
print "$file\n";
}
I experience some issues to list the files with a pattern matching in Perl. I want to exclude the files beginning by "abc" or "ppt" or "jac". But I experience some issues to exclude some files or to list some other files that are not concerned by this exclusion.
I use a pattern like : $sf="abc|ppt|jac";
Have any idea to put a correct pattern?
Thanks a lot.
=======
Here is my script:
opendir(DIRS, "$direc");
@list1 = readdir(DIRS);
closedir(DIRS);
my $sf="abc|ppt|jac";
foreach(@list1){
unless($_ eq '.' || $_ =~ m/^$sf*/){
push(@list2, $_);
}
}
foreach my $file (@list2){
print "$file\n";
}