I am trying to search any file matching this condition *_abc_*.txt in a folder. I knew my regex usage is wrong but somehow I do not know how to fix. Thanks in advance.
chdir $dir;
opendir my $dh, $dir or die "can't open directory:$!";
while (my $entry = readdir $dh){
if($entry !~ m{\ *?_abc_*?[.]txt\z}x){
<do_something>
}
}