Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ブラックリストに含まれる拡張子のファイルを検知
#!/usr/bin/perl
@blacklist = qw(pl conf pm);
$filelist_str = <<EOF;
aaa/bbb/test.jpg
aaa/bbb/test.png
aaa/bbb/test.pl
aaa/bbb/test.pm
aaa/bbb/test.conf
aaa/bbb/test.jpg
EOF
@filelist = split("\n", $filelist_str);
foreach $filename (@filelist) {
if ($filename =~ /.*\.(.*)$/) {
$ext = $1;
if ( grep { $_ eq $ext } @blacklist) {
print("$filename found\n");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.