in reply to Comparing 1 list and 1 array
The `%file' indicates a hash, not what you want here. Change it to%file2 = 'Source.txt' ; # Name the file with source addresses open(INFO, "<%file2" ) ; # Open the file
To extract the countries, you need to see if the IP address in $line1 is contained in $line2:$file2 = 'Source.txt' ; # Name the file with source addresses open(INFO, "<$file2" ) ; # Open the file
That code is still just a start. In addition you will want to check whether the open statements succeed and you will want to use perl -w to turn on warnings that can catch typos like %file above. -Markopen APPEND, ">>conversion.txt"; foreach $line1 (@lines1) { foreach $line2 (@lines2) { print APPEND $line2 if $line2 =~ /$line1/; } } close APPEND;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Comparing 1 list and 1 array
by kjherron (Pilgrim) on Jun 24, 2002 at 22:45 UTC |