Last active
November 28, 2016 15:01
-
-
Save bromne/c1b49009d71ab40ed86a1ac844651799 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# src/htdocs 下の PHP ファイルのパスを取得して表示します。 | |
# ファイル名が php-files.txt に含まれているもののみ取得します。 | |
# @files は「foo.php」のような PHP ファイル名のリスト,行区切り | |
open FILE, '<', 'php-files.txt'; | |
chomp(my @files = <FILE>); | |
# *.php | |
chomp(my @paths = `find src/htdocs -name *.php`); | |
@php_files = (); | |
for my $path (@paths) { | |
for my $php (@files) { | |
if ($path =~ /^.*$php$/) { | |
unshift @php_files, $path; | |
last; | |
} | |
} | |
} | |
# ダメ | |
# my @php_files = grep { | |
# my $path = $_; | |
# for (@files) { | |
# if ($path =~ /^.*$_$/) { | |
# 1; | |
# last; | |
# } | |
# } | |
# 0; | |
# } @paths; | |
print join "\n", @php_files; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment