thank you for your help.i solve it as follow
#!/usr/bin/perl use warnings; use strict; open DOMAINLIST, '<', 'domainlist' or die "Cannot open 'domainlist' be +cause: $!"; chomp( my @list = <DOMAINLIST> ); close DOMAINLIST; open RESULT, '<', 'result' or die "Cannot open 'result' because: $!"; my $domain; #define a hash for count each domain. my %count; while ( my $line = <RESULT> ) { foreach $domain ( @list ) { if ($line =~ /(\Q$domain\E)/g){ $count{$1}++; } } } close RESULT; foreach $domain(keys %count){ print"$domain=$count{$domain}\n"; }
In reply to Re^3: search text file
by Anonymous Monk
in thread search text file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |