#!/perl # open INFO, ' ; # Read it into an array close INFO; # Close the file my %table; # Create a table open IN, ') { # Read file into table chomp; my($ip, $ip2, $country, $region) = split(' ',/,/,4); # Split the IP address from the Country $table{$ip} = $region; } close IN; open(OUT, '>>conversion.txt') or die; foreach $line1 (@line1) # assign @line1 to $line1, one at a time { if ($line1 >= $table{$ip} & $line1 <= $table{$ip2} ) { # Compare the entry from log group to table print OUT $line1, ' ',$table{$line1},"\n" ; # Prints the line of the table } else {print OUT $line1;} } close OUT;