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;
In reply to Re: Comparing 1 list and 1 array
by kvale
in thread Comparing 1 list and 1 array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |