小编Sin*_*egy的帖子

Can't combine two regex statements to work at once

I have a simple perl code that displays the names of the files in a given directory

opendir my $dir, "./images/sampleImages" or die "Cannot open directory: $!";
my @Images = grep {!/^\./} readdir $dir;
closedir $dir;
Run Code Online (Sandbox Code Playgroud)

I have added a regex statement to remove all single and double dots, since readdir adds them as special characters and this is working perfectly fine. However I want only the files with the extensions of .jpg/.jpeg/.png/.gif to be read. I have found a …

regex perl filter

0
推荐指数
1
解决办法
66
查看次数

标签 统计

filter ×1

perl ×1

regex ×1