用m{^site:(.+) inurl:/(.+)} 中的inurl:/
来匹配
site:www. inurl:www20041223am 中的inurl:
可惜匹配不了
来匹配
site:www. inurl:www20041223am 中的inurl:
可惜匹配不了
我就是真命天子,顺我者生,逆我者死!
#! D:/Program Files/Perl/bin/perl.exe -W use strict; my $match_one; my $match_two; if(open(SITE_IN, "E:/Projects/Perl/site_inurl.txt") || die "$!") { foreach (<SITE_IN>) { if( m{^site:(.+) inurl:/?(.+)/?} ) { $match_one = $1; $match_two = $2; if(open(URL_FILE, "E:/Projects/Perl/url.txt") || die "$!") { foreach(<URL_FILE>) { if( m{$match_one.*/$match_two} ) { print $_; } } } close(URL_FILE); } } } close(SITE_IN); 这下测试了过了