in reply to search text file
i have written this code but it doesnt work.
#!/usr/bin/perl -w use strict; my $domain; open(DOMAINLIST,'<domainlist'); my @list=<DOMAINLIST>; my $i=0; my $count=0; open(RESULT,'<result'); while($i<scalar(@list)){ $domain=$list[$i]; chomp $domain; while(<RESULT>){ for (my $line=$_){ chomp $line; if ($line=~/$domain/) { ++$count; print $domain; }}} ++$i; } print "$count"; close RESULT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: search text file
by Anonymous Monk on Jul 26, 2011 at 10:08 UTC | |
by Anonymous Monk on Jul 26, 2011 at 10:40 UTC | |
by jethro (Monsignor) on Jul 26, 2011 at 11:21 UTC | |
|
Re^2: search text file
by jwkrahn (Abbot) on Jul 26, 2011 at 11:15 UTC | |
by Anonymous Monk on Jul 26, 2011 at 14:47 UTC | |
by jwkrahn (Abbot) on Jul 26, 2011 at 23:07 UTC | |
by Anonymous Monk on Jul 26, 2011 at 12:25 UTC |